forked from sharkdp/diskus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes sharkdp#32.
- Loading branch information
Showing
8 changed files
with
58 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,4 @@ extern crate rayon; | |
|
||
pub mod walk; | ||
|
||
pub use walk::Walk; | ||
pub use crate::walk::Walk; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use std::os::unix::fs::MetadataExt; | ||
|
||
pub fn generate_unique_id(metadata: &std::fs::Metadata) -> Option<super::UniqueID> { | ||
// If the entry has more than one hard link, generate | ||
// a unique ID consisting of device and inode in order | ||
// not to count this entry twice. | ||
if metadata.is_file() && metadata.nlink() > 1 { | ||
Some(UniqueID(metadata.dev(), metadata.ino())) | ||
} else { | ||
None | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
pub fn generate_unique_id(_metadata: &std::fs::Metadata) -> Option<super::UniqueID> { | ||
// Since even the Windows-internal tools such as (but not limited to) | ||
// - Powershell, | ||
// - Explorer, | ||
// - dir, | ||
// are not respecting hardlinks or junction points when determining the | ||
// size of a directory [1], it has been decided that diskus will count | ||
// any such entries multiple times. too. | ||
// | ||
// Footnotes: | ||
// [1] https://github.com/sharkdp/diskus/issues/32#issuecomment-532817905 | ||
None | ||
} |