# # patch "ChangeLog" # from [61da542845a62d6631e392cf9a923db437c5c672] # to [52a6fed74e8e948798d452fd58ec05d7d7e2237f] # # patch "file_io.cc" # from [bac267e2021de44e60740191a0b028f6b598d37a] # to [5b50c7cf2a8c3c21ec775980fcf3af07fa91a21a] # ======================================================================== --- ChangeLog 61da542845a62d6631e392cf9a923db437c5c672 +++ ChangeLog 52a6fed74e8e948798d452fd58ec05d7d7e2237f @@ -1,5 +1,13 @@ 2005-08-26 Nathaniel Smith + * file_io.cc (mkdir): New function. Now with extra brain-eating + power. + (mkdir_p, make_dir_for, delete_file, delete_dir_recursive) + (move_file, move_dir, write_data_impl): Use it, to make all + fs::path's native and disable boost's random rejection of paths. + +2005-08-26 Nathaniel Smith + * paths.cc (test_file_path_external_prefix_a_b) (test_file_path_external_no_prefix, test_file_path_internal): Test for validity of more strange characters (,address@hidden). ======================================================================== --- file_io.cc bac267e2021de44e60740191a0b028f6b598d37a +++ file_io.cc 5b50c7cf2a8c3c21ec775980fcf3af07fa91a21a @@ -134,10 +134,16 @@ return false; } +static fs::path +mkdir(any_path const & p) +{ + return fs::path(p.as_external(), fs::native); +} + void mkdir_p(any_path const & p) { - fs::create_directories(p.as_external()); + fs::create_directories(mkdir(p)); } void @@ -146,7 +152,7 @@ fs::path tmp(p.as_external(), fs::native); if (tmp.has_branch_path()) { - fs::create_directories(tmp.branch_path()); + fs::create_directories(fs::path(tmp.branch_path(), fs::native)); } } @@ -156,7 +162,7 @@ require_path_is_file(p, F("file to delete '%s' does not exist") % p, F("file to delete, '%s', is not a file but a directory") % p); - fs::remove(p.as_external()); + fs::remove(mkdir(p)); } void @@ -165,7 +171,7 @@ require_path_is_directory(p, F("directory to delete, '%s', does not exist") % p, F("directory to delete, '%s', is a file") % p); - fs::remove_all(p.as_external()); + fs::remove_all(mkdir(p)); } void @@ -178,7 +184,7 @@ "-- bug in monotone?") % old_path); N(!path_exists(new_path), F("rename target '%s' already exists") % new_path); - fs::rename(old_path.as_external(), new_path.as_external()); + fs::rename(mkdir(old_path), mkdir(new_path)); } void @@ -191,7 +197,7 @@ "-- bug in monotone?") % old_path); N(!path_exists(new_path), F("rename target '%s' already exists") % new_path); - fs::rename(old_path.as_external(), new_path.as_external()); + fs::rename(mkdir(old_path), mkdir(new_path)); } void @@ -298,8 +304,8 @@ } if (path_exists(p)) - N(fs::remove(p.as_external()), F("removing %s failed") % p); - fs::rename(tmp.as_external(), p.as_external()); + N(fs::remove(mkdir(p)), F("removing %s failed") % p); + fs::rename(mkdir(tmp), mkdir(p)); } void