FarGroup / FarManager

File and Archive Manager
https://farmanager.com
BSD 3-Clause "New" or "Revised" License
1.78k stars 197 forks source link

LuaMacro plugin: Enable win.GetFileTimes/win.SetFileTimes to get/set change time #611

Open rohitab opened 1 year ago

rohitab commented 1 year ago

Description of the new feature or improvement

The Lua function win.GetFileTimes returns Creation time, Last access time, and Last write time as shown in the following code. It does not return Change time.

https://github.com/FarGroup/FarManager/blob/2326d88085452dde8658d561f200ee3295a5a0ea/plugins/luamacro/luafar/win.c#L863-L870

Similarly, win.SetFileTimes sets the same time values as shown in the following code. It does not set Change time.

https://github.com/FarGroup/FarManager/blob/2326d88085452dde8658d561f200ee3295a5a0ea/plugins/luamacro/luafar/win.c#L917-L923

Could you please add support for getting and setting Change time as well? This would allow Lua macros to set and restore all file times, similar to the Preserve all timestamps feature in the Copy and Rename/Move dialogs.

Proposed technical implementation details (optional)

Use file::GetTime and file::SetTime instead of GetFileTime and SetFileTime respectively.

https://github.com/FarGroup/FarManager/blob/2326d88085452dde8658d561f200ee3295a5a0ea/far/platform.fs.hpp#L258-L260

johnd0e commented 1 year ago

@shmuz

shmuz commented 1 year ago

@johnd0e, as you know I'm spending all my spare time nowadays on far2m, etc. and there's no ChangeTime there.

johnd0e commented 1 year ago

@shmuz, yes I know. But still hope that some day you will be able to find some time. Or at least give us your opinion about proposed implementation.

shmuz commented 1 year ago
  1. It's not a proposed implementation here, it is just a suggestion to use the same code Far3 uses.
  2. I respect you being a Far3 "patriot", but on the other hand you could help me a lot with far2m but you won't do that.
johnd0e commented 1 year ago

you could help me a lot with far2m but you won't do that.

I will be happy to help where I can. At the moment I have no system where I could run far2m.

rohitab commented 1 year ago

@johnd0e Thank you for trying to get this issue resolved.

  1. It's not a proposed implementation here, it is just a suggestion to use the same code Far3 uses.

@shmuz The suggestion and the proposed implementation are the same, i.e. to use different functions, ones that get/set 4 file times instead of 3. I'd be happy to submit a patch if someone can review and commit it.

shmuz commented 1 year ago

@rohitab

I'd be happy to submit a patch if someone can review and commit it.

It seems to be the right way. It won't guarantee immediate review and commit but the chances would be much higher.