diff options
Diffstat (limited to 'Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs b/Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs index f0b86becf..44c8f1901 100644 --- a/Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs +++ b/Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; +using System.Text.RegularExpressions; using System.Threading.Tasks; using Tango.FileSystem.Network; @@ -41,6 +42,21 @@ namespace Tango.FileSystem return GetRoot(); } + try + { + if (request.Path.Count(x => x == '%') == 2) + { + var variable = Regex.Match(request.Path, "(?<=%)(.*?)(?=%)").Value; + request.Path = request.Path.Replace($"%{variable}%", Environment.ExpandEnvironmentVariables($"%{variable}%")); + } + } + catch + { + throw new ArgumentException("Could not parse environment variable."); + } + + request.Path = Path.GetFullPath(request.Path); + if (!Directory.Exists(request.Path)) { throw new DirectoryNotFoundException("The specified directory could not be located."); |
