File size

FeepingCreature feepingcreature at gmail.com
Wed Aug 23 08:48:26 UTC 2023


On Tuesday, 22 August 2023 at 16:22:52 UTC, harakim wrote:
> On Monday, 21 August 2023 at 11:05:36 UTC, FeepingCreature 
> wrote:
>> Can you print some of the wrong sizes? D's DirEntry iteration 
>> code just calls `FindFirstFileW`/`FindNextFileW`, so this 
>> *shouldn't* be a D-specific issue, and it should be possible 
>> to reproduce this in C.
>
> Thanks for the suggestion. I was working on getting the list 
> for you when I decided to first try and reproduce this on 
> Linux. I was not able to do so. Then I opened the Linux File 
> Explorer and went to one of the files. There were two files by 
> that name, with names differing only by case.
>
> In windows, I only saw one, because Windows Explorer only 
> supports one file with an identical case-insensitive name per 
> directory. Unsurprisingly, that is also the one that was 
> selected by getSize(filename). The underlying windows functions 
> must ignore case as well and select the same way as Explorer 
> (which makes sense). That explains why Windows Explorer 
> reported the same size as getsize(name) in every case, while 
> DirEntry.size would match for the file with the same case as 
> windows recognized and not for the file with a different case. 
> I was able to get into this state because I copied the files 
> (merged directories) in Linux.
>
> It was interesting to look into. It seems everything is working 
> as designed. It shouldn't be an issue for me going forward 
> either as I move more and more towards Linux.

That's hilarious! I'm happy you found it.


More information about the Digitalmars-d-learn mailing list