Hi All,

Request you help on the below code, the below code always state the file does not exist even if the file do exist.

Code:

import core.stdc.stdlib: exit;
import std.stdio;
import std.file;
import std.path;

auto osSwitch () {
string ConfigFile;
version (Windows) { ConfigFile = absolutePath(`.\nasconfig.txt`); } else version (Linux) { ConfigFile = absolutePath(`nasconfig.txt`); }
return ConfigFile;
}
void main () {
auto ConfigFile = osSwitch;
if (!ConfigFile.exists) { writeln("The Configuration File ", buildNormalizedPath(ConfigFile), " do to exist, Terminating the execution.."); exit(-1);}
else { writeln(ConfigFile); }
}

From,
Vino.B

Reply via email to