Browse Source

Reimplementing Session.FileExists using Session.TryGetFileInfo

Source commit: 47791132d088135b70af0cab1a951cd25244341b
Martin Prikryl 3 years ago
parent
commit
b24bf52e47
1 changed files with 1 additions and 22 deletions
  1. 1 22
      dotnet/Session.cs

+ 1 - 22
dotnet/Session.cs

@@ -1570,28 +1570,7 @@ namespace WinSCP
 
 
         public bool FileExists(string path)
         public bool FileExists(string path)
         {
         {
-            using (CreateCallstackAndLock())
-            {
-                CheckOpened();
-
-                try
-                {
-                    _ignoreFailed = true;
-                    try
-                    {
-                        DoGetFileInfo(path);
-                    }
-                    finally
-                    {
-                        _ignoreFailed = false;
-                    }
-                    return true;
-                }
-                catch (SessionRemoteException)
-                {
-                    return false;
-                }
-            }
+            return TryGetFileInfo(path, out _);
         }
         }
 
 
         public byte[] CalculateFileChecksum(string algorithm, string path)
         public byte[] CalculateFileChecksum(string algorithm, string path)