FarManager icon indicating copy to clipboard operation
FarManager copied to clipboard

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

Open rohitab opened this issue 2 years ago • 7 comments

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

rohitab avatar Jan 21 '23 18:01 rohitab

@shmuz

johnd0e avatar Jul 21 '23 11:07 johnd0e

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

shmuz avatar Jul 21 '23 11:07 shmuz

@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.

johnd0e avatar Jul 21 '23 12:07 johnd0e

  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.

shmuz avatar Jul 21 '23 12:07 shmuz

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.

johnd0e avatar Jul 21 '23 12:07 johnd0e

@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.

rohitab avatar Jul 22 '23 02:07 rohitab

@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.

shmuz avatar Jul 22 '23 07:07 shmuz