SystemPath.cs
 1  // Copyright (c) Microsoft Corporation
 2  // The Microsoft Corporation licenses this file to you under the MIT license.
 3  // See the LICENSE file in the project root for more information.
 4  
 5  using System.Text.RegularExpressions;
 6  
 7  namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces
 8  {
 9      internal sealed class SystemPath
10      {
11          private static readonly Regex WindowsPath = new Regex(@"^([a-zA-Z]:)", RegexOptions.Compiled);
12  
13          public static string RealPath(string path)
14          {
15              if (WindowsPath.IsMatch(path))
16              {
17                  string windowsPath = path.Replace("/", "\\");
18                  return $"{windowsPath[0]}".ToUpperInvariant() + windowsPath.Remove(0, 1);
19              }
20              else
21              {
22                  return path;
23              }
24          }
25      }
26  }