
Hi, I started using filesystem, regex, and bind today. It's been interesting. I'm using Visual C++ 8.0 on an XP machine that has network filesystems mounted to it, some using letters (H:\, Y:\, etc.), some accessable via two slashes (//linden/temp/, etc). I'd like to peruse these using boost::filesystem. The following works: std::string t = "h:\\temp"; boost::filesystem::path p(t, boost::filesystem::native); but I can't get filesystem to work with the string "h:/temp"; std::string s = p.string(); // s = "h:/temp" bool b = boost::filesystem::portable_posix_name(s); //returns false b = boost::filesystem::windows_name(s); //returns false b = boost::filesystem::portable_name(s); //returns false b = boost::filesystem::portable_directory_name(s); //returns false b = boost::filesystem::portbale_file_name(s); //returns false b = boost::filesystem::native(s); //returns false Also, I'd like to do the following std::string q = "//linden/temp/"; boost::filesystem::path p2(q); Any help is appreciated. thanks, matthew

On 2/2/07, Polder, Matthew J
Hi,
I started using filesystem, regex, and bind today. It's been interesting.
I'm using Visual C++ 8.0 on an XP machine that has network filesystems mounted to it, some using letters (H:\, Y:\, etc.), some accessable via two slashes (//linden/temp/, etc). I'd like to peruse these using boost::filesystem.
The following works:
std::string t = "h:\\temp"; boost::filesystem::path p(t, boost::filesystem::native);
but I can't get filesystem to work with the string "h:/temp";
std::string s = p.string(); // s = "h:/temp"
h:/temp doesn't work in windows explorer either. You're mixing windows drive letters with POSIX path separators! Try h:\temp instead.
bool b = boost::filesystem::portable_posix_name(s); //returns false b = boost::filesystem::windows_name(s); //returns false b = boost::filesystem::portable_name(s); //returns false b = boost::filesystem::portable_directory_name(s); //returns false b = boost::filesystem::portbale_file_name(s); //returns false b = boost::filesystem::native(s); //returns false
Also, I'd like to do the following
std::string q = "//linden/temp/"; boost::filesystem::path p2(q);
Again, your slashes are backwards, use \\linden\temp\.
Any help is appreciated.
thanks, matthew
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Richard Dingwall
On 2/2/07, Polder, Matthew J
wrote: (...) The following works:
std::string t = "h:\\temp"; boost::filesystem::path p(t, boost::filesystem::native);
but I can't get filesystem to work with the string "h:/temp";
std::string s = p.string(); // s = "h:/temp"
h:/temp doesn't work in windows explorer either. You're mixing windows drive letters with POSIX path separators!
Try h:\temp instead.
Well, at least on any NT based system I've worked yet h:/temp is synonym with h:\temp. AFAIK on Windows / and \ are mostly equivalent as path separators (I'm not sure about the \\computername syntax, but for local paths / mapped network drives it just works). Best regards, Markus
(...)

On 2/2/07, Markus Grueneis
Richard Dingwall
wrote: On 2/2/07, Polder, Matthew J
wrote: (...) The following works:
std::string t = "h:\\temp"; boost::filesystem::path p(t, boost::filesystem::native);
but I can't get filesystem to work with the string "h:/temp";
std::string s = p.string(); // s = "h:/temp"
h:/temp doesn't work in windows explorer either. You're mixing windows drive letters with POSIX path separators!
Try h:\temp instead.
Well, at least on any NT based system I've worked yet h:/temp is synonym with h:\temp.
Hmm you're right, I take that back.
AFAIK on Windows / and \ are mostly equivalent as path separators (I'm not sure about the \\computername syntax, but for local paths / mapped network drives it just works).
Best regards, Markus
(...)
Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (3)
-
Markus Grueneis
-
Polder, Matthew J
-
Richard Dingwall