Browse Source

读取文本文件判断是否存在

melon.yin 3 years ago
parent
commit
bed1cb50b4
1 changed files with 1 additions and 0 deletions
  1. 1 0
      fis/Managers/TextFileManager.cs

+ 1 - 0
fis/Managers/TextFileManager.cs

@@ -44,6 +44,7 @@ namespace fis.Managers
             try
             {
                 string filePath = GetFilePath(name);
+                if (!File.Exists(filePath)) return null;
                 string text = await File.ReadAllTextAsync(filePath, Encoding.UTF8);
                 return text;
             }