[Monodevelop-patches-list] r579 - trunk/MonoDevelop/src/Main/Core/Services
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Mon Jan 19 20:52:34 EST 2004
Author: benm
Date: 2004-01-19 20:52:34 -0500 (Mon, 19 Jan 2004)
New Revision: 579
Modified:
trunk/MonoDevelop/src/Main/Core/Services/FileUtilityService.cs
Log:
path fixups
Modified: trunk/MonoDevelop/src/Main/Core/Services/FileUtilityService.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Core/Services/FileUtilityService.cs 2004-01-20 00:23:48 UTC (rev 578)
+++ trunk/MonoDevelop/src/Main/Core/Services/FileUtilityService.cs 2004-01-20 01:52:34 UTC (rev 579)
@@ -42,7 +42,8 @@
/// </summary>
public class FileUtilityService : AbstractService
{
- readonly static char[] separators = { Path.DirectorySeparatorChar, Path.VolumeSeparatorChar };
+ readonly static char[] separators = { Path.DirectorySeparatorChar, Path.VolumeSeparatorChar, Path.AltDirectorySeparatorChar };
+ readonly static char[] dir_sep = { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar };
string sharpDevelopRootPath;
public string SharpDevelopRootPath {
@@ -109,9 +110,15 @@
/// from the base path to the absoulte path. (as a relative path)
/// </summary>
public string AbsoluteToRelativePath(string baseDirectoryPath, string absPath)
- {
- string[] bPath = baseDirectoryPath.Split(separators);
- string[] aPath = absPath.Split(separators);
+ {
+ if (! Path.IsPathRooted (absPath))
+ return absPath;
+
+ absPath = Path.GetFullPath (absPath);
+ baseDirectoryPath = Path.GetFullPath (baseDirectoryPath);
+
+ string[] bPath = baseDirectoryPath.Split (separators);
+ string[] aPath = absPath.Split (separators);
int indx = 0;
for(; indx < Math.Min(bPath.Length, aPath.Length); ++indx){
if(!bPath[indx].Equals(aPath[indx]))
@@ -145,8 +152,8 @@
/*if (separators[0] != separators[1] && relPath.IndexOf(separators[1]) != -1) {
return relPath;
}*/
- string[] bPath = baseDirectoryPath.Split(separators[0]);
- string[] rPath = relPath.Split(separators[0]);
+ string[] bPath = baseDirectoryPath.Split(dir_sep);
+ string[] rPath = relPath.Split(dir_sep);
int indx = 0;
for (; indx < rPath.Length; ++indx) {
@@ -163,7 +170,7 @@
erg += separators[0] + String.Join(Path.DirectorySeparatorChar.ToString(), rPath, indx, rPath.Length-indx);
- return erg;
+ return Path.GetFullPath (erg);
}
/// <summary>
More information about the Monodevelop-patches-list
mailing list