[filesystem] Can't create absolute paths from strings on windows

cout << "init path " << initial_path().string() << endl; cout << "init path exists " << exists(initial_path()) << endl; prints: init path C:/Documents and Settings/me/workspace/3.2/DciApiTest init path exists 1 But if I try to construct the same path from a string: I get: path init_path2(initial_path().string(), no_check); // I've also tried 'native' checker cout << "init path 2 " << init_path2.string() << endl; cout << "init path 2 exists " << exists(init_path2) << endl; I get: init path 2 C:Documents and Settings/ken.klose/workspace/3.2/DciApiTest init path 2 exists 0 The / after the : gets lost and therefore the file isn't found. Thanks in advance! BTW: Using MinGW.

I read this in the boost docs: Rationale: It is not considered an error for rhs to include a root-directory because m_name might be relative or empty, and thus it is valid for rhs to supply root-directory. For example, on Windows, the following must succeed: path p( "c:", native ); p /= "/foo"; assert( p.string() == "c:/foo" ); So I tried the code and the first line blew up: boost::filesystem::path: invalid name "c:" in path: "c:" Thanks "Ken Klose" <ken.klose@future-skies.com> wrote in message news:f0nuro$tb2$1@sea.gmane.org...
cout << "init path " << initial_path().string() << endl; cout << "init path exists " << exists(initial_path()) << endl;
prints:
init path C:/Documents and Settings/me/workspace/3.2/DciApiTest init path exists 1
But if I try to construct the same path from a string: I get:
path init_path2(initial_path().string(), no_check); // I've also tried 'native' checker cout << "init path 2 " << init_path2.string() << endl; cout << "init path 2 exists " << exists(init_path2) << endl;
I get:
init path 2 C:Documents and Settings/ken.klose/workspace/3.2/DciApiTest init path 2 exists 0
The / after the : gets lost and therefore the file isn't found.
Thanks in advance!
BTW: Using MinGW.

Anders, Thanks for taking the time to help me out! I guess my question wasn't 100% clear. I've already figured out that I'm going to deliver a static lib along with some (but not all header files). My question is more on how to organize my project to facilitate this. Right now I've got the project folder full of cpp and h files. As it stands when delivery time comes I'll build the lib and manually copy it along with some of the header files onto a disk. This doesn't strike me as being the "right way". I'm hoping you (and/or someone else) can say "we organize our cpp files like xxx" and "the header files that are for our use only go here, and the header files we deliver go here". Etc. Thanks, Ken "Ken Klose" <ken.klose@future-skies.com> wrote in message news:f0o5fn$npl$1@sea.gmane.org...
I read this in the boost docs:
Rationale: It is not considered an error for rhs to include a root-directory because m_name might be relative or empty, and thus it is valid for rhs to supply root-directory. For example, on Windows, the following must succeed:
path p( "c:", native ); p /= "/foo"; assert( p.string() == "c:/foo" );
So I tried the code and the first line blew up: boost::filesystem::path: invalid name "c:" in path: "c:"
Thanks
"Ken Klose" <ken.klose@future-skies.com> wrote in message news:f0nuro$tb2$1@sea.gmane.org...
cout << "init path " << initial_path().string() << endl; cout << "init path exists " << exists(initial_path()) << endl;
prints:
init path C:/Documents and Settings/me/workspace/3.2/DciApiTest init path exists 1
But if I try to construct the same path from a string: I get:
path init_path2(initial_path().string(), no_check); // I've also tried 'native' checker cout << "init path 2 " << init_path2.string() << endl; cout << "init path 2 exists " << exists(init_path2) << endl;
I get:
init path 2 C:Documents and Settings/ken.klose/workspace/3.2/DciApiTest init path 2 exists 0
The / after the : gets lost and therefore the file isn't found.
Thanks in advance!
BTW: Using MinGW.
participants (1)
-
Ken Klose