Fix rbuild compilation, by adding Path::RelativeFromDirectory method
Modified: trunk/reactos/tools/rbuild/XML.cpp
Modified: trunk/reactos/tools/rbuild/XML.h
_____
Modified: trunk/reactos/tools/rbuild/XML.cpp
--- trunk/reactos/tools/rbuild/XML.cpp 2005-08-28 09:07:43 UTC (rev
17579)
+++ trunk/reactos/tools/rbuild/XML.cpp 2005-08-28 09:50:00 UTC (rev
17580)
@@ -172,21 +172,27 @@
string
Path::RelativeFromWorkingDirectory ( const string& path )
{
- vector<string> vwork, vpath, vout;
- Path::Split ( vwork, working_directory, true );
+ return Path::RelativeFromDirectory ( path, working_directory );
+}
+
+string
+Path::RelativeFromDirectory ( const string& path, const string&
base_directory )
+{
+ vector<string> vbase, vpath, vout;
+ Path::Split ( vbase, base_directory, true );
Path::Split ( vpath, path, true );
#ifdef WIN32
// this squirreliness is b/c win32 has drive letters and *nix
doesn't...
// not possible to do relative across different drive letters
- if ( vwork[0] != vpath[0] )
+ if ( vbase[0] != vpath[0] )
return path;
#endif
size_t i = 0;
- while ( i < vwork.size() && i < vpath.size() && vwork[i] ==
vpath[i] )
+ while ( i < vbase.size() && i < vpath.size() && vbase[i] ==
vpath[i] )
++i;
- if ( i < vwork.size() )
+ if ( i < vbase.size() )
{
- // path goes above our working directory, we will need
some ..'s
+ // path goes above our base directory, we will need some
..'s
for ( size_t j = 0; j < i; j++ )
vout.push_back ( ".." );
}
_____
Modified: trunk/reactos/tools/rbuild/XML.h
--- trunk/reactos/tools/rbuild/XML.h 2005-08-28 09:07:43 UTC (rev
17579)
+++ trunk/reactos/tools/rbuild/XML.h 2005-08-28 09:50:00 UTC (rev
17580)
@@ -44,6 +44,7 @@
std::string RelativeFromWorkingDirectory ();
static std::string RelativeFromWorkingDirectory ( const
std::string& path );
+ static std::string RelativeFromDirectory ( const std::string&
path, const std::string& base_directory);
static void Split ( std::vector<std::string>& out,
const std::string& path,