ofToDataPath format on Windows, double slash

On windows I have an issue with the ofToDataPath function, on one machine I get one backslash, on the other I get two. This makes ofxXmlSettings fail to load (with double slashes).

I have tracked the windows getcwd function, which is the one returning either \\ or \ . I have no idea why though.

Yeah I have had a similar problem with the data pathing, i usually have to do a string replace function since something it gives forward slashes too

where are we using that function? ofToDataPath should be normalizing the path so there’s no problems like this

Not really an issue, false alarm. Future reader, notice:

Visual Studio debugger will show either \\ or \ when debugging a string that contains a single backslash, which format it chooses depends on who knows what (room temperature probably). In any case you can just cout the string in order to see the real value.

In my case I was just using the wrong path name, the debugger showing two backslashes is no error. It was just a coincidence that in another project (on Windows also) it showed a single backslash and loading another file worked fine.

I’d have to dig through the projects to find the specific time i needed to do that because I can’t remember what exactly was causing the problem. Its possible it was something on my end but if i find it ill open an issue on github

great thanks. the best way to handle paths to avoid this problems is to use std::filesystem::path which when compared doens’t do a strict string comparison and will work for / or \ or double // or even comparing absolute and relative paths if they exist. you just need to wrap the string for the path like:

std::filesystem::path("some/path") == std::filesystem::path("some//path")

which should return true