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

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jul 25 02:56:43 PDT 2017


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

          Issue ID: 17681
           Summary: [Function setTimes] additional function touch(f)
           Product: D
           Version: D2
          Hardware: All
               URL: http://dlang.org/library/std/file.html
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P3
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: mt at smartdolphin.de

Problem on Linux:
When trying to set the date (mtime) of an file f, 
from owner y by user x, who as writing permissions, via:

import std.datetime;
auto time = Clock.currTime();
setTimes(f,time,time);

You get "Operation not permitted."

This is caused on linux by the rule, that if you are not the owner of the file
you may only set the mtime of a file to current time. 

Which could not be achieved when calling 
setTimes(f, Clock.currTime(),Clock.currTime());

So a function touch(f), which ensures this behavior would be useful. 


The work around in the moment is to use execute("touch ~"filename").
Not the right for a system programming language :-(

--


More information about the Digitalmars-d-bugs mailing list