mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-31 19:26:42 +00:00
don't crash if path == base_directory.
sorry I forgot to commit my changes to this file last night svn path=/trunk/; revision=17583
This commit is contained in:
@@ -176,7 +176,9 @@ Path::RelativeFromWorkingDirectory ( const string& path )
|
||||
}
|
||||
|
||||
string
|
||||
Path::RelativeFromDirectory ( const string& path, const string& base_directory )
|
||||
Path::RelativeFromDirectory (
|
||||
const string& path,
|
||||
const string& base_directory )
|
||||
{
|
||||
vector<string> vbase, vpath, vout;
|
||||
Path::Split ( vbase, base_directory, true );
|
||||
@@ -190,6 +192,8 @@ Path::RelativeFromDirectory ( const string& path, const string& base_directory )
|
||||
size_t i = 0;
|
||||
while ( i < vbase.size() && i < vpath.size() && vbase[i] == vpath[i] )
|
||||
++i;
|
||||
if ( vbase.size() == vpath.size() && i == vpath.size() )
|
||||
return ".";
|
||||
if ( i < vbase.size() )
|
||||
{
|
||||
// path goes above our base directory, we will need some ..'s
|
||||
|
||||
Reference in New Issue
Block a user