# # patch "ChangeLog" # from [62b8757ad08e503020166c2fc36f3919aabd23b4] # to [886ed56ea00b1588e98fee17931ec4811fc3118e] # # patch "paths.cc" # from [3ea54d2be240cc811a52130f6711f3c3ae410763] # to [2ab3420630ae1620569dcccdd6fb52e422bddcaa] # # patch "win32/fs.cc" # from [dc98eb08c96cda5ca2e73e8a29dea19cb40b00bf] # to [bfc8bc3aaa07a3ec97a5d555ee4af563a118546d] # ======================================================================== --- ChangeLog 62b8757ad08e503020166c2fc36f3919aabd23b4 +++ ChangeLog 886ed56ea00b1588e98fee17931ec4811fc3118e @@ -1,6 +1,11 @@ +2005-09-29 Matthew Gregan + + * paths.cc, win32/fs.cc: Fixes to allow unit tests to pass on Win32. + 2005-09-29 Marcel van der Boom - * netsync.cc (rebuild_merkle_trees): only get matched branch certs, not all of them + * netsync.cc (rebuild_merkle_trees): only get matched branch + certs, not all of them 2005-09-28 Nathaniel Smith ======================================================================== --- paths.cc 3ea54d2be240cc811a52130f6711f3c3ae410763 +++ paths.cc 2ab3420630ae1620569dcccdd6fb52e422bddcaa @@ -392,7 +392,11 @@ static std::string normalize_out_dots(std::string const & path) { +#ifdef WIN32 + return fs::path(path, fs::native).normalize().string(); +#else return fs::path(path, fs::native).normalize().native_file_string(); +#endif } system_path::system_path(any_path const & other, bool in_true_working_copy) @@ -556,7 +560,9 @@ ".foo/bar", "..foo/bar", "MTfoo/bar", +#ifndef WIN32 "foo:bar", +#endif 0 }; for (int i = 0; i < 2; ++i) @@ -649,7 +655,9 @@ check_fp_normalizes_to(".foo/bar", ".foo/bar"); check_fp_normalizes_to("..foo/bar", "..foo/bar"); check_fp_normalizes_to(".", ""); +#ifndef WIN32 check_fp_normalizes_to("foo:bar", "foo:bar"); +#endif check_fp_normalizes_to("foo/with,address@hidden/bar", "foo/with,address@hidden/bar"); @@ -698,7 +706,9 @@ check_fp_normalizes_to(".foo/bar", "a/b/.foo/bar"); check_fp_normalizes_to("..foo/bar", "a/b/..foo/bar"); check_fp_normalizes_to(".", "a/b"); +#ifndef WIN32 check_fp_normalizes_to("foo:bar", "a/b/foo:bar"); +#endif check_fp_normalizes_to("foo/with,address@hidden/bar", "a/b/foo/with,address@hidden/bar"); // why are the tests with // in them commented out? because boost::fs sucks @@ -845,13 +855,12 @@ #ifdef WIN32 check_system_normalizes_to("c:foo", "c:foo"); check_system_normalizes_to("c:/foo", "c:/foo"); - check_system_normalizes_to("c:\\foo", "c:\\foo"); #else check_system_normalizes_to("c:foo", "/a/b/c:foo"); check_system_normalizes_to("c:/foo", "/a/b/c:/foo"); check_system_normalizes_to("c:\\foo", "/a/b/c:\\foo"); -#endif check_system_normalizes_to("foo:bar", "/a/b/foo:bar"); +#endif // we require that system_path normalize out ..'s, because of the following // case: // /work mkdir newdir @@ -870,13 +879,17 @@ // can't do particularly interesting checking of tilde expansion, but at // least we can check that it's doing _something_... std::string tilde_expanded = system_path("~/foo").as_external(); +#ifdef WIN32 + BOOST_CHECK(tilde_expanded[1] == ':'); +#else BOOST_CHECK(tilde_expanded[0] == '/'); +#endif BOOST_CHECK(tilde_expanded.find('~') == std::string::npos); // and check for the weird WIN32 version #ifdef WIN32 std::string tilde_expanded2 = system_path("~this_user_does_not_exist_anywhere").as_external(); BOOST_CHECK(tilde_expanded2[0] = '/'); - BOOST_CHECK(tilde_expanded.find('~') == std::string::npos); + BOOST_CHECK(tilde_expanded2.find('~') == std::string::npos); #else BOOST_CHECK_THROW(system_path("~this_user_does_not_exist_anywhere"), informative_failure); #endif ======================================================================== --- win32/fs.cc dc98eb08c96cda5ca2e73e8a29dea19cb40b00bf +++ win32/fs.cc bfc8bc3aaa07a3ec97a5d555ee4af563a118546d @@ -91,7 +91,8 @@ fs::path res; if (*i == "~" || i->size() > 1 && i->at(0) == '~') { - res /= get_homedir()(); + fs::path restmp(get_homedir()(), fs::native); + res /= restmp; ++i; } while (i != tmp.end())