diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-03-17 05:14:20 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-03-17 05:14:20 +0200 |
| commit | 062292c7b822247d74e4470dd8a509284b0d5eda (patch) | |
| tree | dc77b89e254cc151b64c891b106afa9827f2c55d /Software/Visual_Studio/Tango.FileSystem/FileSystemManager.cs | |
| parent | 3bc7ddaf3b52eeae095e82e062156dde37e4805b (diff) | |
| download | Tango-062292c7b822247d74e4470dd8a509284b0d5eda.tar.gz Tango-062292c7b822247d74e4470dd8a509284b0d5eda.zip | |
Changes to file system monitoring.
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."); |
