
I'm trying to use boost::filesystem::create_directories() with a path of the form \\?\Volume{Guid}\foo on windows. This seems to break the filesystem library because it doesn't understand the path syntax. when recursing up the parents it removes the slash at each level, so it ends up calling boost::filesystem::exists(L"\\?\Volume{Guid}") which always returns false, I think because GetFileAttributes() requires that paths in this syntax end with a trailing \, whereas the trailing \ has been removed. I'm tempted to fix this, but I'm sure this algorithm is fragile and any change I apply is likely to break another case. Does anyone have any suggestions on how to fix this? Thanks

On Wed, Mar 24, 2010 at 12:42 AM, Zachary Turner <divisortheory@gmail.com>wrote:
I'm trying to use boost::filesystem::create_directories() with a path of the form \\?\Volume{Guid}\foo on windows. This seems to break the filesystem library because it doesn't understand the path syntax. when recursing up the parents it removes the slash at each level, so it ends up calling boost::filesystem::exists(L"\\?\Volume{Guid}") which always returns false, I think because GetFileAttributes() requires that paths in this syntax end with a trailing \, whereas the trailing \ has been removed.
I'm tempted to fix this, but I'm sure this algorithm is fragile and any change I apply is likely to break another case. Does anyone have any suggestions on how to fix this?
Thanks _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
That's right. With this simple test: char volPath[MAX_PATH] = {0}; char *volMount = "C:\\"; GetVolumeNameForVolumeMountPointA(volMount, volPath, MAX_PATH); strcat(volPath, "foo\\"); fs::create_directories(volPath); , it fails, because, when checking the parent dir, it removes the trailing \. Also, this is related to https://svn.boost.org/trac/boost/ticket/2138 Ilie.

On Mar 24, 2010, at 5:04 AM, Ilie Halip <lupuroshu@gmail.com> wrote:
On Wed, Mar 24, 2010 at 12:42 AM, Zachary Turner <divisortheory@gmail.com
wrote:
I'm trying to use boost::filesystem::create_directories() with a path of the form \\?\Volume{Guid}\foo on windows. This seems to break the filesystem library because it doesn't understand the path syntax. when recursing up the parents it removes the slash at each level, so it ends up calling boost::filesystem::exists(L"\\?\Volume{Guid}") which always returns false, I think because GetFileAttributes() requires that paths in this syntax end with a trailing \, whereas the trailing \ has been removed.
I'm tempted to fix this, but I'm sure this algorithm is fragile and any change I apply is likely to break another case. Does anyone have any suggestions on how to fix this?
Thanks _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
That's right. With this simple test:
char volPath[MAX_PATH] = {0}; char *volMount = "C:\\"; GetVolumeNameForVolumeMountPointA(volMount, volPath, MAX_PATH); strcat(volPath, "foo\\"); fs::create_directories(volPath);
, it fails, because, when checking the parent dir, it removes the trailing \.
Also, this is related to https://svn.boost.org/trac/boost/ticket/2138
Ilie. _______________________________________________
Can you see any problem with applying a fix where we just dont remove the trailing slash before recursing? Zach

Can you see any problem with applying a fix where we just dont remove the trailing slash before recursing?
Zach
I'm not a Boost developer, sorry, just a GSoC enthusiast :) . But my guess is that you can hack the code, run the automated tests and do some testing yourself to see if anything else broke, and you can submit a patch for review - either here or on Trac. Have a nice day. Ilie.

Zachary Turner wrote:
Can you see any problem with applying a fix where we just dont remove the trailing slash before recursing?
I think that in POSIX, if foo is a symlink to something that doesn't exist then exists("foo") will be true, but exists("foo/") will be false. In this particular algorithm I don't see this issue breaking something that works if you make your suggested change (barring crazy race conditions), but it could change the failure mode. John Bytheway
participants (3)
-
Ilie Halip
-
John Bytheway
-
Zachary Turner