BurntSushi / same-file

Cross platform Rust library for checking whether two file paths are the same file.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

File size is not actually checked on Windows

Sh4rK opened this issue · comments

I was checking out the source of this library purely out of interest, and while the comments and docs say at a few places that file size is compared on windows to avoid some false positives, this does not actually seem to be the case.

The key used for comparison on Windows is

struct Key {
    volume: u64,
    index: u64,
}

which does not include the file size, nor could I find any other place where file size is taken into account.

Hmmm. It looks like it got dropped a long time ago in this commit: bbf6959

Sadly, I did not mention it in the commit message and I have no idea now why I dropped the file size comparison. That is not up to my usual standards, sorry about that.

I think in principle I'd be okay adding it back. I can't think of a reason why I dropped it.