I get path from command line parameter where path could be written in 4 different ways
testdir
./testdir
c:/my path/testdir
I would like to know how to prepare the path before I can test it. I just tried
path = "./testdir" and I got error that the directory does not exist. But it does. So how should I pass the path? Do I need complete name of path and how to get it?
I am getting the path like this char * workingPath = _getcwd( NULL, 0);
Isn't this platform dependent? ./testdir should work on Linux, but I don't think that's a path definition on Windows. c:/my path/testdir should work on windows but probably not on Linux since it needs either a relative path definition (relative to where you run the program from) or an absolute path definition which on Linux I think would not start from c.
So if you work on Windows, I think "./testdir" wouldn't work on Windows and might not work on Linux if you're not in the parent directory of testdir. Which package/module (sorry don't know exactly what the right term is for C++) does the method _getcwd belong to? Probably the same package contains a method for getting the absolute path. I would recommend getting the absolute path if possible.