[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ros-diffs
Subject:    [ros-diffs] [hpoussin] 17580: Fix rbuild compilation,
From:       <hpoussin () svn ! reactos ! com>
Date:       2005-08-28 9:50:08
Message-ID: 000001c5abb5$e03cfa10$6b01a8c0 () PENELOPE
[Download RAW message or body]

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,

[Attachment #3 (text/html)]

<html>
<head>
<style>
<!--
body { background-color:#ffffff }
.file { border:1px solid #eeeeee; margin-top:1em; margin-bottom:1em }
.pathname { font-family:monospace; float:right }
.fileheader { margin-bottom:.5em }
.diff { margin:0 }
.tasklist { padding:4px; border:1px dashed #000000; margin-top:1em }
.tasklist ul { margin-top:0; margin-bottom:0 }
tr.alt { background-color:#eeeeee }
#added { background-color:#ddffdd }
#addedchars { background-color:#99ff99; font-weight:bolder }
tr.alt #added { background-color:#ccf7cc }
#removed { background-color:#ffdddd }
#removedchars { background-color:#ff9999; font-weight:bolder }
tr.alt #removed { background-color:#f7cccc }
#info { color:#888888 }
#context { background-color:#eeeeee }
td {padding-left:.3em; padding-right:.3em }
tr.head { border-bottom-width:1px; border-bottom-style:solid }
tr.head td { padding:0; padding-top:.2em }
.task { background-color:#ffff00 }
.comment { padding:4px; border:1px dashed #000000; background-color:#ffffdd }
.error { color:red }
hr { border-width:0px; height:2px; background:black }
-->
</style>
</head>
<body>
<pre class="comment">Fix rbuild compilation, by adding Path::RelativeFromDirectory \
method</pre><pre class="diff" id="context">Modified: \
                trunk/reactos/tools/rbuild/XML.cpp
Modified: trunk/reactos/tools/rbuild/XML.h
</pre><hr /><div class="file">
<div class="fileheader"><big><b>Modified: \
trunk/reactos/tools/rbuild/XML.cpp</b></big></div> <pre class="diff"><small \
                id="info">--- 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 @@
</small></pre><pre class="diff" id="context"> string
 Path::RelativeFromWorkingDirectory ( const string&amp; path )
 {
</pre><pre class="diff" id="removed">-	vector&lt;string&gt; vwork, vpath, vout;
-	<span id="removedchars">Path::Split ( vwork, working_directory, true</span> );
</pre><pre class="diff" id="added">+	<span id="addedchars">return \
Path::RelativeFromDirectory ( path, working_directory</span> ); +}
+
+string
+Path::RelativeFromDirectory ( const string&amp; path, const string&amp; \
base_directory ) +{
+	vector&lt;string&gt; vbase, vpath, vout;
+	Path::Split ( vbase, base_directory, true );
</pre><pre class="diff" id="context"> 	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
</pre><pre class="diff" id="removed">-	if ( v<span id="removedchars">work</span>[0] \
!= vpath[0] ) </pre><pre class="diff" id="added">+	if ( v<span \
id="addedchars">base</span>[0] != vpath[0] ) </pre><pre class="diff" id="context"> \
return path;  #endif
 	size_t i = 0;
</pre><pre class="diff" id="removed">-	while ( i &lt; v<span \
id="removedchars">work.size() &amp;&amp; i &lt; vpath.size() &amp;&amp; \
vwork</span>[i] == vpath[i] ) </pre><pre class="diff" id="added">+	while ( i &lt; \
v<span id="addedchars">base.size() &amp;&amp; i &lt; vpath.size() &amp;&amp; \
vbase</span>[i] == vpath[i] ) </pre><pre class="diff" id="context"> 		++i;
</pre><pre class="diff" id="removed">-	if ( i &lt; v<span \
id="removedchars">work</span>.size() ) </pre><pre class="diff" id="added">+	if ( i \
&lt; v<span id="addedchars">base</span>.size() ) </pre><pre class="diff" \
id="context"> 	{ </pre><pre class="diff" id="removed">-		// path goes above our <span \
id="removedchars">working</span> directory, we will need some ..'s </pre><pre \
class="diff" id="added">+		// path goes above our <span id="addedchars">base</span> \
directory, we will need some ..'s </pre><pre class="diff" id="context"> 		for ( \
size_t j = 0; j &lt; i; j++ )  vout.push_back ( &quot;..&quot; );
 	}
</pre></div>
<hr /><div class="file">
<div class="fileheader"><big><b>Modified: \
trunk/reactos/tools/rbuild/XML.h</b></big></div> <pre class="diff"><small \
                id="info">--- 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 @@
</small></pre><pre class="diff" id="context"> 
 	std::string RelativeFromWorkingDirectory ();
 	static std::string RelativeFromWorkingDirectory ( const std::string&amp; path );
</pre><pre class="diff" id="added">+	static std::string RelativeFromDirectory ( const \
std::string&amp; path, const std::string&amp; base_directory); </pre><pre \
class="diff" id="context">   static void Split ( std::vector&lt;std::string&gt;&amp; \
out,  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;const \
std::string&amp; path, </pre>
</div>

</body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic