# # patch "ChangeLog" # from [b7e175d10a92e15e3e360ef589191d5d48c08f5c] # to [09b961cfe6a1528cdd39b99a41b9803eee21c39d] # # patch "paths.cc" # from [02b9bf1f7db2f48dc950e9ec0d8499c9ef0bf50f] # to [7f37aa38ee4c273d555f49b665a157efed9808c8] # # patch "paths.hh" # from [14a123196045205e5dc96fe888c6ee081101e271] # to [8e81b86a732f309ba8babcbe5a03eaa10d07e2f6] # ======================================================================== --- ChangeLog b7e175d10a92e15e3e360ef589191d5d48c08f5c +++ ChangeLog 09b961cfe6a1528cdd39b99a41b9803eee21c39d @@ -1,5 +1,9 @@ 2005-08-24 Nathaniel Smith + * paths.{cc,hh}: More fixes. + +2005-08-24 Nathaniel Smith + * paths.{cc,hh}: Reorganize a bit. Implement file_path and bookkeeping_path. ======================================================================== --- paths.cc 02b9bf1f7db2f48dc950e9ec0d8499c9ef0bf50f +++ paths.cc 7f37aa38ee4c273d555f49b665a157efed9808c8 @@ -26,6 +26,8 @@ // system_path's. static system_path working_root; +bookkeeping_path const bookkeeping_root("MT"); + void save_initial_path() { @@ -147,14 +149,15 @@ tmp = tmp.normalize(); data = utf8(tmp.string()); } - assert_sane(); + I(fully_normalized_path(data())); + I(not_in_bookkeeping_dir(data())); } -void -file_path::assert_sane() +bookkeeping_path::bookkeeping_path(std::string const & path) { - I(fully_normalized_path(data())); - I(not_in_bookkeeping_dir(data())); + I(fully_normalized_path(path)); + I(!not_in_bookkeeping_dir(path)); + data = path; } /////////////////////////////////////////////////////////////////////////// @@ -263,23 +266,29 @@ // this code's speed does not matter much /////////////////////////////////////////////////////////////////////////// -static inline std::string -operator_slash(any_path const & path, std::string appended) +file_path +file_path::operator /(std::string const & to_append) const { - I(false); - //FIXME + if (empty()) + return file_path_internal(to_append); + else + return file_path_internal(data() + "/" + to_append); } -file_path -file_path::operator /(std::string const & to_append) +bookkeeping_path +bookkeeping_path::operator /(std::string const & to_append) const { - return file_path_internal(data() + "/" + to_append); + if (empty()) + return bookkeeping_path(to_append); + else + return bookkeeping_path(data() + "/" + to_append); } -bookkeeping_path -bookkeeping_path::operator /(std::string const & to_append) +system_path +system_path::operator /(std::string const & to_append) const { - return bookkeeping_path(data() + "/" + to_append); + I(!empty()); + return system_path(data() + "/" + to_append); } /////////////////////////////////////////////////////////////////////////// ======================================================================== --- paths.hh 14a123196045205e5dc96fe888c6ee081101e271 +++ paths.hh 8e81b86a732f309ba8babcbe5a03eaa10d07e2f6 @@ -113,7 +113,7 @@ class system_path : public any_path { public: - system_path(); + system_path() {}; explicit system_path(any_path const & other); // this path can contain anything, and it will be absolutified and // tilde-expanded. it will considered to be relative to the directory