[Issue 17681] [Function setTimes] additional function touch(f)

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jul 26 02:44:32 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17681

--- Comment #1 from Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> ---
The way to do this on Linux is to call utime(fileName, null).

(In reply to Martin Tschierschke from comment #0)
> The work around in the moment is to use execute("touch ~"filename").
> Not the right for a system programming language :-(

I think this is simpler:

utimes(fileName.toStringz, *cast(timeval[2]*)null);

Not sure whether this is something that comes up frequently enough to be in
Phobos, especially considering it seems rather platform-specific. The name
"touch" carries with it the possible implication that non-existing files will
be created (as done by the program), which might not be desirable for a Phobos
function.

--


More information about the Digitalmars-d-bugs mailing list