Kaynağa Gözat

Checking in right place

Piotr Czajkowski 22 saat önce
ebeveyn
işleme
e12cde0f56
1 değiştirilmiş dosya ile 6 ekleme ve 6 silme
  1. 6 6
      ProcessFiles/ProcessFiles.cs

+ 6 - 6
ProcessFiles/ProcessFiles.cs

@@ -19,6 +19,12 @@ namespace ProcessFiles
 
 
         private Result WhatIsIt(string path)
         private Result WhatIsIt(string path)
         {
         {
+            if (!File.Exists(path))
+            {
+                errors.Add($"{path} doesn't exist!");
+                return Result.Failure;
+            }
+            
             try
             try
             {
             {
                 var attr = File.GetAttributes(path);
                 var attr = File.GetAttributes(path);
@@ -47,12 +53,6 @@ namespace ProcessFiles
 
 
         private bool IsValid(string path, string[] fileExtensions)
         private bool IsValid(string path, string[] fileExtensions)
         {
         {
-            if (!File.Exists(path))
-            {
-                errors.Add($"{path} doesn't exist!");
-                return false;
-            }
-
             var extension = GetExtension(path);
             var extension = GetExtension(path);
             if (extension == null)
             if (extension == null)
                 return false;
                 return false;