From e36c452d4e891073768fd70915a65531f806f831 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Thu, 19 Feb 2009 14:16:22 +0000 Subject: * Reverted Prebuild commit due to strange run-time errors. --- Prebuild/src/Core/Utilities/Helper.cs | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'Prebuild/src/Core/Utilities/Helper.cs') diff --git a/Prebuild/src/Core/Utilities/Helper.cs b/Prebuild/src/Core/Utilities/Helper.cs index 9a0d131..19093ce 100644 --- a/Prebuild/src/Core/Utilities/Helper.cs +++ b/Prebuild/src/Core/Utilities/Helper.cs @@ -23,6 +23,15 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY O */ #endregion +#region CVS Information +/* + * $Source$ + * $Author: jendave $ + * $Date: 2007-02-14 05:58:03 +0900 (Wed, 14 Feb 2007) $ + * $Revision: 205 $ + */ +#endregion + using System; using System.Collections; using System.Diagnostics; @@ -280,8 +289,6 @@ namespace Prebuild.Core.Utilities return true; } - static readonly char seperator = Path.DirectorySeparatorChar; - // This little gem was taken from the NeL source, thanks guys! /// /// Makes a relative path @@ -291,8 +298,8 @@ namespace Prebuild.Core.Utilities /// Path that will get from startPath to endPath public static string MakePathRelativeTo(string startPath, string endPath) { - string tmp = NormalizePath(startPath, seperator); - string src = NormalizePath(endPath, seperator); + string tmp = NormalizePath(startPath, '/'); + string src = NormalizePath(endPath, '/'); string prefix = ""; while(true) @@ -305,14 +312,14 @@ namespace Prebuild.Core.Utilities { return "./"; } - if((src.Length > tmp.Length) && src[tmp.Length - 1] != seperator) + if ((src.Length > tmp.Length) && src[tmp.Length-1] != '/' && src[tmp.Length-1] != '\\') { } else { ret = prefix + endPath.Substring(size, endPath.Length - size); ret = ret.Trim(); - if(ret[0] == seperator) + if(ret[0] == '/' || ret[0] == '\\') { ret = "." + ret; } @@ -327,8 +334,8 @@ namespace Prebuild.Core.Utilities break; } - int lastPos = tmp.LastIndexOf(seperator, tmp.Length - 2); - int prevPos = tmp.IndexOf(seperator); + int lastPos = tmp.LastIndexOf('/', tmp.Length - 2); + int prevPos = tmp.IndexOf('/'); if((lastPos == prevPos) || (lastPos == -1)) { @@ -336,7 +343,7 @@ namespace Prebuild.Core.Utilities } tmp = tmp.Substring(0, lastPos + 1); - prefix += ".." + seperator.ToString(); + prefix += "../"; } return endPath; -- cgit v1.1