Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changed file path separators on Windows

Moderators: larsivi kris

Posted: 12/24/11 15:23:42

Hi there,

I have some problems with the newest Tango/DMD bundle (0.99.9 Kai) and my two year old code, which I wanted to update. It seems that the file path separators on Windows (win 7, 32 bit) have changed from '\' to '/' but even my updated code doesn't run properly. I can't check the existence of a file with FilePath?.exists. See example below:


int main(char[][] args)

    //auto testfile = new FilePath("C:\\test.txt"); // tango.core.Exception.IOException: unexpected '\' character in path: C:\test.txt

    auto testfile = new FilePath("C:/test.txt"); // Compiles, but doesn't find the file

    //testfile.native; // Compiles, but doesn't find the file

    if (testfile.exists){Cout("File test.txt found.").newline;}else{Cout("File test.txt not found.").newline;}
    return 0;


Thanks for your help. Regards Engineer

Author Message

Posted: 12/25/11 13:43:54

I'm not completely sure but I think you should always use "/" as path separator, regardless if you're on Windows or Posix