From 062292c7b822247d74e4470dd8a509284b0d5eda Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Tue, 17 Mar 2020 05:14:20 +0200 Subject: Changes to file system monitoring. --- .../Visual_Studio/Tango.FileSystem/FileSystemManager.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'Software/Visual_Studio/Tango.FileSystem') 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."); -- cgit v1.3.1