abique/tmfs — pull request #12 by jwm (2013-03-03 03:19:25+00:00)
Title: Support compilation with boost earlier than 1.46

Thanks for writing tmfs! I tried compiling it on a machine running Debian squeeze (the current stable release). The build failed since that version includes libboost 1.42, so I modified tmfs to build with earlier versions of boost.

boost::filesystem::path.c_str() and .absolute() were added in boost 1.46, but it looks like the code can be modified to work without them. I added a helper function, c_str(), to replace .c_str().

Also, it looks like .absolute() isn't getting rid of "/./..//././" garbage like the comment in get_real_path() says. For example, this code:

printf("absolute: %s\n",
c_str(bfs::absolute("/foo/bar/./..//.././././baz", "/").string()));

emits:

absolute: /foo/bar/./..//.././././baz

http://www.boost.org/doc/libs/1_46_1/libs/filesystem/v3/doc/reference.html#absolute makes it seem like this is expected behavior when .absolute()'s base argument is "/", which it always is in get_real_path(). I just removed the call to .absolute() in get_real_path().

tmfs builds and seems to work fine on a backup generated by OS X 10.8 (Mountain Lion). Thanks again for tmfs; it's been very useful.