diff options
author | Greg Munn <greg@sgmunn.com> | 2016-09-06 23:40:55 +0300 |
---|---|---|
committer | Greg Munn <greg@sgmunn.com> | 2016-09-06 23:42:09 +0300 |
commit | c3cd0622b7fa588f10d6d5712ba4e3853d7e672c (patch) | |
tree | b88e7628a39a1cefccf00b6d87697e6af174c8c6 | |
parent | 105cb64488156fa2754873755a5c7dfe428bd22c (diff) |
Revert "Fix crash when calculating absolute path"
This reverts commit d16761db3385aef3a138486099091c7678d3851f.
The commit introduces bug https://bugzilla.xamarin.com/show_bug.cgi?id=44036
-rw-r--r-- | main/src/core/MonoDevelop.Core/MonoDevelop.Core/FileService.cs | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FileService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FileService.cs index 38907b8523..cac183b079 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FileService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FileService.cs @@ -454,7 +454,7 @@ namespace MonoDevelop.Core // handle case a: some/path b: some/path/deeper... if (a >= aEnd) { if (IsSeparator (*b)) { - lastStartA = aEnd; + lastStartA = a + 1; lastStartB = b; } } @@ -466,14 +466,7 @@ namespace MonoDevelop.Core goUpCount++; lastStartB++; } - int remainingPathLength = (int)(aEnd - lastStartA); - var size = goUpCount * 2 + goUpCount; - if (remainingPathLength > 0) { - if (goUpCount > 0) - size++; - size += remainingPathLength; - } - + var size = goUpCount * 2 + goUpCount + aEnd - lastStartA; var result = new char [size]; fixed (char* rPtr = result) { // go paths up @@ -481,8 +474,7 @@ namespace MonoDevelop.Core for (int i = 0; i < goUpCount; i++) { *(r++) = '.'; *(r++) = '.'; - if (i != goUpCount - 1 || remainingPathLength > 0) // If there is no remaining path, there is no need for a trailing slash - *(r++) = Path.DirectorySeparatorChar; + *(r++) = Path.DirectorySeparatorChar; } // copy the remaining absulute path while (lastStartA < aEnd) |