Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

boost::filesystem::file_size error when using a path with whitespace

I'm asking boost::filesystem::file_size for a file with path "/tmp/test\ file.txt", and it reports no such file or directory when it is there.

Error: fs::file_size("/tmp/test\ file.txt") reported boost::filesystem::file_size: No such file or directory
-rw-rw-r-- 1 rturrado users 12486 Mar 15 12:01 /tmp/test file.txt

Are there any considerations when using paths with escaped sequences in boost::filesystem?

like image 639
rturrado Avatar asked Dec 04 '25 14:12

rturrado


1 Answers

Closing this question, as I fixed the issue thanks to Mat and ymett comments.

boost::filesystem::file_size("/tmp/test file.txt") works just fine. You don't need any escaping.

like image 184
rturrado Avatar answered Dec 07 '25 03:12

rturrado