mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +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:
parent
bb6a166390
commit
cdf2899515
1 changed files with 5 additions and 1 deletions
|
@ -176,7 +176,9 @@ Path::RelativeFromWorkingDirectory ( const string& path )
|
||||||
}
|
}
|
||||||
|
|
||||||
string
|
string
|
||||||
Path::RelativeFromDirectory ( const string& path, const string& base_directory )
|
Path::RelativeFromDirectory (
|
||||||
|
const string& path,
|
||||||
|
const string& base_directory )
|
||||||
{
|
{
|
||||||
vector<string> vbase, vpath, vout;
|
vector<string> vbase, vpath, vout;
|
||||||
Path::Split ( vbase, base_directory, true );
|
Path::Split ( vbase, base_directory, true );
|
||||||
|
@ -190,6 +192,8 @@ Path::RelativeFromDirectory ( const string& path, const string& base_directory )
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
while ( i < vbase.size() && i < vpath.size() && vbase[i] == vpath[i] )
|
while ( i < vbase.size() && i < vpath.size() && vbase[i] == vpath[i] )
|
||||||
++i;
|
++i;
|
||||||
|
if ( vbase.size() == vpath.size() && i == vpath.size() )
|
||||||
|
return ".";
|
||||||
if ( i < vbase.size() )
|
if ( i < vbase.size() )
|
||||||
{
|
{
|
||||||
// path goes above our base directory, we will need some ..'s
|
// path goes above our base directory, we will need some ..'s
|
||||||
|
|
Loading…
Reference in a new issue