devkitPro / libctru

Homebrew development library for Nintendo 3DS/Horizon OS user mode (Arm11)

Home Page:https://libctru.devkitpro.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Any way to set the modification time of a file?

yossariano opened this issue · comments

Hello-

I'm working on a program which syncs retroarch save files between a remote service and my 3DS by comparing timestamps. I have everything working pretty nicely at the moment except that I am unable to set the modification time of a downloaded file to match the time that was on the server, so the local files end up having the current timestamp instead of the last modified time of the file on the server, which screws things up for when we try to sync next since it then tries to upload the "newer" file.

utime() and utimes() fail with "function not implemented". Fair enough- I was wondering if anyone has any ideas on how to go about doing this since I cannot use the usual approach. archive_getmtime works brilliantly for getting the local file mod time, but there is no corresponding archive_setmtime. I've tried following the code to see how to go about implementing that but I fear it is a bit above my paygrade.

Is there any known way of modifying the mtime of a file on the 3DS sdmc in code? If not, I would like to request such a feature be added (if it is impossible for some reason, no worries).

Same problem here. Seems that it's only possible to fetch mtime but no way to write it.

Just read some documentation on the fs subsystem. Is it a limitation on the OS's side?

That's correct. The OS only has an API to retrieve the mtime of a file. The only way to update the mtime is to open the file with FS_WRITE_UPDATE_TIME which updates the file's mtime to the current time when written to.