#
# patch "ChangeLog"
# from [2bf5d46d3636d44d7913bb30c40b4ecd9744129d]
# to [657ac02e21096d2d9a45fd4cae26087a8c1e27c8]
#
# patch "app_state.cc"
# from [0c74ac9f4088c41625e4c7c508bd503479c57b5b]
# to [98405b4920c78d88f2c1854a35e8e94640234604]
#
# patch "file_io.hh"
# from [c235365c658cc4716e935087ada543b663f7bb0c]
# to [8864571732a091a7c652c1605f32118708b7cf94]
#
# patch "lua.cc"
# from [40cea21efcbbbcb98eb2c502cf971b10ab76e521]
# to [df6be5cd73a13e0917cc79b8df30144a10422e1c]
#
# patch "lua.hh"
# from [38945dd7ac35f3f1ef7d4027ad1874f8b3716e26]
# to [38e760eb2add9e8c846abc3f3ea77a0aa8378d66]
#
# patch "paths.hh"
# from [220e9bcce99b4025b4aed3e9f2c97c58a91fbd76]
# to [bba60652b42f333ccf0d9d2fd542900cf8065596]
#
========================================================================
--- ChangeLog 2bf5d46d3636d44d7913bb30c40b4ecd9744129d
+++ ChangeLog 657ac02e21096d2d9a45fd4cae26087a8c1e27c8
@@ -1,5 +1,13 @@
2005-08-23 Nathaniel Smith
+ * lua.{cc,hh}: Mostly convert to paths.hh. (Still uses boost::fs
+ internally for some directory iteration.)
+ * app_state.cc (load_rcfiles): Update accordingly.
+ * file_io.hh (path_state): De-templatify; take any_path instead of
+ a T.
+
+2005-08-23 Nathaniel Smith
+
* paths.cc (any_path): New base class.
(file_path, bookkeeping_path, system_path): Inherit from it.
* transforms.{hh,cc} (utf8_to_system): Actually, always take a
========================================================================
--- app_state.cc 0c74ac9f4088c41625e4c7c508bd503479c57b5b
+++ app_state.cc 98405b4920c78d88f2c1854a35e8e94640234604
@@ -414,8 +414,8 @@
if (rcfiles)
{
- fs::path default_rcfile;
- fs::path working_copy_rcfile;
+ system_path default_rcfile;
+ bookkeeping_path working_copy_rcfile;
lua.default_rcfilename(default_rcfile);
lua.working_copy_rcfilename(working_copy_rcfile);
lua.load_rcfile(default_rcfile, false);
========================================================================
--- file_io.hh c235365c658cc4716e935087ada543b663f7bb0c
+++ file_io.hh 8864571732a091a7c652c1605f32118708b7cf94
@@ -60,11 +60,7 @@
file = 2;
} state;
}
-path::state path_state_raw_(std::string const & path_raw);
-template path::state path_state(T const & path)
-{
- return path_state_raw_(path.as_external());
-}
+path::state path_state(any_path const & path);
bool directory_exists(bookkeeping_path const & path);
bool directory_exists(file_path const & path);
========================================================================
--- lua.cc 40cea21efcbbbcb98eb2c502cf971b10ab76e521
+++ lua.cc df6be5cd73a13e0917cc79b8df30144a10422e1c
@@ -31,6 +31,7 @@
#include "vocab.hh"
#include "platform.hh"
#include "transforms.hh"
+#include "paths.hh"
// defined in {std,test}_hooks.lua, converted
#include "test_hooks.h"
@@ -650,15 +651,15 @@
}
void
-lua_hooks::default_rcfilename(fs::path & file)
+lua_hooks::default_rcfilename(system_path & file)
{
- file = mkpath(get_homedir()) / mkpath(".monotone/monotonerc");
+ file = system_path(get_homedir() + "/.monotone/monotonerc");
}
void
-lua_hooks::working_copy_rcfilename(fs::path & file)
+lua_hooks::working_copy_rcfilename(bookkeeping_path & file)
{
- file = mkpath(book_keeping_dir) / mkpath("monotonerc");
+ file = bookkeeping_path("monotonerc");
}
@@ -668,7 +669,7 @@
I(st);
if (rc() != "-")
{
- fs::path locpath(localized(rc));
+ fs::path locpath(system_path(rc).as_external());
if (fs::exists(locpath) && fs::is_directory(locpath))
{
// directory, iterate over it, skipping subdirs, taking every filename,
@@ -684,7 +685,7 @@
std::sort(arr.begin(), arr.end());
for (std::vector::iterator i= arr.begin(); i != arr.end(); ++i)
{
- load_rcfile(*i, true);
+ load_rcfile(system_path(*i.native_directory_string()), true);
}
return; // directory read, skip the rest ...
}
@@ -698,20 +699,20 @@
}
void
-lua_hooks::load_rcfile(fs::path const & rc, bool required)
+lua_hooks::load_rcfile(any_path const & rc, bool required)
{
I(st);
- if (fs::exists(rc))
+ if (path_state(rc))
{
- L(F("opening rcfile '%s' ...\n") % rc.string());
- N(run_file(st, rc.string()),
- F("lua error while loading '%s'") % rc.string());
- L(F("'%s' is ok\n") % rc.string());
+ L(F("opening rcfile '%s' ...\n") % rc);
+ N(run_file(st, rc.as_external()),
+ F("lua error while loading '%s'") % rc);
+ L(F("'%s' is ok\n") % rc);
}
else
{
- N(!required, F("rcfile '%s' does not exist") % rc.string());
- L(F("skipping nonexistent rcfile '%s'\n") % rc.string());
+ N(!required, F("rcfile '%s' does not exist") % rc);
+ L(F("skipping nonexistent rcfile '%s'\n") % rc);
}
}
========================================================================
--- lua.hh 38945dd7ac35f3f1ef7d4027ad1874f8b3716e26
+++ lua.hh 38e760eb2add9e8c846abc3f3ea77a0aa8378d66
@@ -32,10 +32,10 @@
void add_test_hooks();
#endif
void add_std_hooks();
- void working_copy_rcfilename(fs::path & file);
- void default_rcfilename(fs::path & file);
+ void working_copy_rcfilename(bookkeeping_path & file);
+ void default_rcfilename(system_path & file);
void load_rcfile(utf8 const & file);
- void load_rcfile(fs::path const & file, bool required);
+ void load_rcfile(any_path const & file, bool required);
// cert hooks
bool hook_expand_selector(std::string const & sel, std::string & exp);
========================================================================
--- paths.hh 220e9bcce99b4025b4aed3e9f2c97c58a91fbd76
+++ paths.hh bba60652b42f333ccf0d9d2fd542900cf8065596
@@ -25,6 +25,9 @@
return pc == the_null_component;
}
+// It's possible this will become a proper virtual interface in the future,
+// but since the implementation is exactly the same in all cases, there isn't
+// much point ATM...
class any_path
{
public: