summaryrefslogtreecommitdiff
path: root/modules/mono
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-09-13 08:11:04 +0200
committerGitHub <noreply@github.com>2020-09-13 08:11:04 +0200
commitf5c60794041e11b703a7521d5f24c08b9e8b0e9d (patch)
tree3d86957283bfe21bc478a8872fec8877230aa9bb /modules/mono
parent463879db56cc1e2417a02696e41ae3c40324ac24 (diff)
parent1db039595088d1f16b15a82950470c9b38c1bb17 (diff)
Merge pull request #42019 from neikeq/issue-41909
C#: Fix csproj not synced on file move/removal from FS dock
Diffstat (limited to 'modules/mono')
-rw-r--r--modules/mono/editor/GodotTools/GodotTools.Core/StringExtensions.cs15
1 files changed, 13 insertions, 2 deletions
diff --git a/modules/mono/editor/GodotTools/GodotTools.Core/StringExtensions.cs b/modules/mono/editor/GodotTools/GodotTools.Core/StringExtensions.cs
index 05e06babd4..b217ae4bf7 100644
--- a/modules/mono/editor/GodotTools/GodotTools.Core/StringExtensions.cs
+++ b/modules/mono/editor/GodotTools/GodotTools.Core/StringExtensions.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
+using System.Runtime.InteropServices;
namespace GodotTools.Core
{
@@ -35,7 +36,17 @@ namespace GodotTools.Core
path = string.Join(Path.DirectorySeparatorChar.ToString(), parts).Trim();
- return rooted ? Path.DirectorySeparatorChar + path : path;
+ if (!rooted)
+ return path;
+
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ string maybeDrive = parts[0];
+ if (maybeDrive.Length == 2 && maybeDrive[1] == ':')
+ return path; // Already has drive letter
+ }
+
+ return Path.DirectorySeparatorChar + path;
}
private static readonly string DriveRoot = Path.GetPathRoot(Environment.CurrentDirectory);
@@ -49,7 +60,7 @@ namespace GodotTools.Core
public static string ToSafeDirName(this string dirName, bool allowDirSeparator = false)
{
- var invalidChars = new List<string> { ":", "*", "?", "\"", "<", ">", "|" };
+ var invalidChars = new List<string> {":", "*", "?", "\"", "<", ">", "|"};
if (allowDirSeparator)
{