mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
[GH-ISSUE #366] Use Size on Disk on Windows #165
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @pandaninjas on GitHub (Feb 6, 2024).
Original GitHub issue: https://github.com/bootandy/dust/issues/366
On Windows, Dust should use Size on Disk instead of Size, because OneDrive and other cloud storage providers can create files which do not take up space on the disk
@sergeevabc commented on GitHub (Feb 18, 2024):
@pandaninjas, could you provide an example: the current output and the desired output?
@pandaninjas commented on GitHub (Feb 18, 2024):
Example with my OneDrive folder


"Old Stuff" in reality is saved entirely to the cloud with no space used on disk
@sergeevabc commented on GitHub (Feb 19, 2024):
Dear @bootandy, what do you think about that?
@bootandy commented on GitHub (Feb 19, 2024):
Hmm,
I softly agree with @pandaninjas
I don't have a windows box so it would be great if one of you wants to try experimenting with tweaking the code.
Size is read here for windows.
https://github.com/bootandy/dust/blob/master/src/platform.rs#L100
The API I'm using to read the size of the file in Windows is here:
https://doc.rust-lang.org/std/os/windows/fs/trait.MetadataExt.html#tymethod.file_size
(Although I can't see anything like 'size-on-disk' there).
I also think this would be a great place to utilize the 'use_apparent_size' flag: '-s' (currently only works on Linux & Mac). If we can bring it to windows that would be good.
So in summary, if it possible to do this then yes I'd accept a PR with this change (And ideally integrate the '-s' flag for windows too).