nathanhi / pyfatfs

Python based FAT12/FAT16/FAT32 implementation with VFAT support
https://pypi.org/project/pyfatfs/
MIT License
31 stars 14 forks source link

Files have correct date but no time #22

Closed abrasive closed 2 years ago

abrasive commented 2 years ago

Hi, thanks for the fantastic tool!

I'm having a bit of trouble with __combine_dosdatetime in FATDirectoryEntry.py. It combines the date and time, but it doesn't return the result of the .combine() call, instead returning the (unmodified) dt.

I can fix this for my use case by changing it to

        return dt.combine(dt, DosDateTime.deserialize_time(tm))

but I think this makes it return a datetime.datetime instead of a DosDateTime; what do you think is the correct fix?

nathanhi commented 2 years ago

Yes, this is indeed a bug and instead the newly created DosDateTime class instance returned by the combine call should be returned. In my tests it returned the proper DosDateTime instance, as inheritance is handled correctly by the underlying datetime class. Here's what I get raising a type(ValueError) for the returned dt object:

image

Should therefore be fixed in v1.0.3, could you please test?

abrasive commented 2 years ago

My bad, the type inference indicated it returned a datetime.datetime so my language server was complaining! Works perfectly for me.

Thanks for cutting a new release so quickly, much appreciated 🙏🏻

On 28 February 2022 08:04:46 "Nathan-J. Hirschauer" @.***> wrote:

Reopened #22. — Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.Message ID: @.***>

nathanhi commented 2 years ago

Awesome, thanks for verifying!