From cdf28995154e98c17d7b3f6dd52fba4474cd2355 Mon Sep 17 00:00:00 2001 From: Royce Mitchell III Date: Sun, 28 Aug 2005 12:08:53 +0000 Subject: [PATCH] don't crash if path == base_directory. sorry I forgot to commit my changes to this file last night svn path=/trunk/; revision=17583 --- reactos/tools/rbuild/XML.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/reactos/tools/rbuild/XML.cpp b/reactos/tools/rbuild/XML.cpp index 96547562496..af1cb10a0da 100644 --- a/reactos/tools/rbuild/XML.cpp +++ b/reactos/tools/rbuild/XML.cpp @@ -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 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