#
# patch "ChangeLog"
# from [d8c8b6f6d7c069754cdbc017ea2e6d18cc59597e]
# to [6b1cb53cd93bd075671c9bed80791b7822f22426]
#
# patch "paths.cc"
# from [f7dd2e61be1d6bf17092af94749435f520020c02]
# to [bd2f39862eb4b9c2b5f96981db66c1b1c84d63d3]
#
========================================================================
--- ChangeLog d8c8b6f6d7c069754cdbc017ea2e6d18cc59597e
+++ ChangeLog 6b1cb53cd93bd075671c9bed80791b7822f22426
@@ -1,5 +1,12 @@
2005-08-24 Nathaniel Smith
+ * paths.cc (find_and_go_to_working_copy, save_initial_path)
+ (go_to_working_copy): Use new checked structure.
+ (operator <<): Make sure we can log our access_tracked values
+ without marking them as used.
+
+2005-08-24 Nathaniel Smith
+
* paths.cc (struct access_tracker): Add invariant checking on
lifetime usage of path roots.
========================================================================
--- paths.cc f7dd2e61be1d6bf17092af94749435f520020c02
+++ paths.cc bd2f39862eb4b9c2b5f96981db66c1b1c84d63d3
@@ -36,6 +36,13 @@
T value;
bool initialized, used;
access_tracker() : initialized(false), used(false);
+};
+// need this so we can log our values
+// logging does not count as using...
+template ostream &
+operator <<(ostream & o, access_tracker const & a)
+{
+ o << a.value;
}
// paths to use in interpreting paths from various sources,
@@ -56,7 +63,7 @@
save_initial_path()
{
// FIXME: BUG: this only works if the current working dir is in utf8
- initial_abs_path = system_path(get_current_working_dir());
+ initial_abs_path.set(system_path(get_current_working_dir()), false);
fs::initial_path();
L(F("initial abs path is: %s") % initial_abs_path);
}
@@ -283,6 +290,7 @@
operator <<(std::ostream & o, any_path const & a)
{
o << a.as_internal();
+ return o;
}
///////////////////////////////////////////////////////////////////////////
@@ -367,8 +375,8 @@
return false;
}
- working_root = current.native_file_string();
- initial_rel_path = file_path_internal(removed.string());
+ working_root.set(current.native_file_string(), true);
+ initial_rel_path.set(file_path_internal(removed.string()), true);
L(F("working root is '%s'") % working_root);
L(F("initial relative path is '%s'") % initial_rel_path);
@@ -381,8 +389,8 @@
void
go_to_working_copy(system_path const & new_working_copy)
{
- working_root = new_working_copy;
- initial_rel_path = file_path();
+ working_root.set(new_working_copy, true);
+ initial_rel_path.set(file_path(), true);
change_current_working_dir(new_working_copy);
}