c++ - convert file path from windows to linux and back again, using boost::filesystem -


is me, or boost::filesystem::path::make_preferred not convert "\" "/"?

davidan@kempt:~/documents/prog/work!$ ../practice/./path_info c:\pitou foo/bar\baa.txt
composed path:
cout << -------------: "c:pitou/foo/bar\baa.txt"
make_preferred()----------: "c:pitou/foo/bar\baa.txt"

i rather hoping

c:\pitou\foo\bar\baa.txt

on windows ,

/pitou/foo/bar/baa.txt

(or close) on posix

the source here: boost::filesystem tutorial

the reason not handled on linux explained nicely here:

http://theboostcpplibraries.com/boost.filesystem-paths

quote:

if example 35.5 executed on linux, returned values different. of member functions return empty string, except relative_path() , filename(), return "c:\windows\system". means string “c:\windows\system” interpreted file name on linux, understandable given neither portable encoding of path nor platform-dependent encoding on linux. therefore, boost.filesystem has no choice interpret file name.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -