Exemple #1
0
        public void Execute(string directoryPath)
        {
            directoryPath = FileSystemHelpers.EnsureFullPath(directoryPath);

            if (!Directory.Exists(directoryPath))
            {
                throw new DirectoryNotFoundException($"Directory not found: {directoryPath}");
            }

            ExecuteDirectory(directoryPath);
        }
Exemple #2
0
 public static bool TryEnsureFullPath(string path, [NotNullWhen(true)] out string?fullPath)
 {
     try
     {
         fullPath = FileSystemHelpers.EnsureFullPath(path);
         return(true);
     }
     catch (ArgumentException ex)
     {
         WriteError($"Path '{path}' is invalid: {ex.Message}.");
         fullPath = null;
         return(false);
     }
 }