Why file.exists of relative path on Linux always return false?
Suliman via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Feb 29 06:50:51 PST 2016
I am trying to check relative path on Linux for exists.
import std.stdio;
import std.path;
import std.file;
import std.string;
string mypath = "~/Documents/imgs";
void main()
{
if(!mypath.exists)
{
writeln(mypath, " do not exists");
}
if(!mypath.exists)
{
writeln(mypath, " do not exists");
}
if("/home/dima/Documents/imgs".exists)
{
writeln("/home/dima/Documents/imgs");
writeln("Dir exists");
}
}
~/Documents/imgs always return "do not exists". But full path:
"/home/dima/Documents/imgs" is "Dir exists".
Why? It's same paths!
More information about the Digitalmars-d-learn
mailing list