-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
os.setLastModificationTime*(file: string, t: times.Time) #7543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Please, add a tests. |
|
Looks good, but is there a reason why If not, I think it's better to just deprecate |
What would |
|
It could take unix seconds and nanoseconds as separate arguments: @hendrikgit The test failures on AppVeyor/Travis is because of the JS target. The constants |
|
@GULPF If you're planning to have a |
|
@dom96 |
|
Oops, I missed it. Good to know. |
|
Maybe to introduce OSFileTime type? |
The constants were moved out of the when defined(JS) block so that they are alsways available in proc toWinTime. proc toWinTime was moved above the # Deprecated procs comment. Best new location seemed to be with the toUnix proc.
|
I think this is too special of a need for |
|
@Araq |
Is this in general to this PR of @data-man's comment? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small comment, but otherwise this looks good.
| if h == INVALID_HANDLE_VALUE: raiseOSError(osLastError()) | ||
| var ft = t.toWinTime.toFILETIME | ||
| let res = setFileTime(h, nil, nil, ft.addr) | ||
| discard h.closeHandle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would check this return value instead of discarding it. But it seems that most people disagree with me on this (I can see os doing a lot of this :)
|
What's the plan for a release date for the next version of Nim? I'm excited to see this added as I have need for it. Also is the best way to get a prerelease build to build it myself? |
|
This week (hopefully) |
|
@dom96 super! |
This PR is to add
proc setLastModificationTime*(file: string, t: times.Time)to os.The proc setLastModificationTime is missing it's pragma, I was not sure what was required there.
toWinTimewas added to avoid unixTimeToWinTime which expects CTime and CTime is not exported.I have not figured out yet how to only set the last modification time with utimes, so I set the last access time too. Is that acceptable behaviour? The utimes documentation says only the whole times array can be null (in that case both times will be set to current time) or they each need to have a value.