On Friday, 4 May 2018 at 15:30:26 UTC, Vino wrote:
On Friday, 4 May 2018 at 15:16:23 UTC, wjoe wrote:
[...]
Hi Wjoe,
Thank you very much, but what i am expecting is something
like OS switch, based of OS type switch the funciton eg:
If OS is windows use the funciton timeCreated else if the OS is
linux use the function timeLastAccessed in the below example
program, something similar as stated in the link
https://dlang.org/spec/declaration.html#alias
Eg1:
version (Win32)
{
alias myfoo = win32.foo;
}
version (linux)
{
alias myfoo = linux.bar;
}
auto clogClean (string LogDir ) {
Array!(Tuple!(string, SysTime)) dFiles;
version (Windows) { alias sTimeStamp =
std.file.DirEntry.timeCreated;} else version (linux) { alias
sTimeStamp = std.file.DirEntry.timeLastAccessed; }
dFiles.insert(dirEntries(LogDir, SpanMode.shallow).filter!(a =>
a.isFile).map!(a => tuple(a.name, a.sTimeStamp)));
return dFiles;
}
From,
Vino.B
I think that's not possible. You can't query information that
hasn't been stored.
Your best bet in a Change-Function-Name-Port would probably be to
use access time and mount the file system with options that won't
touch that anymore after creation. But me thinks such a solution
would be rather unreliable and not worth the time investment.