Skip to content

Commit 5c1dc07

Browse files
committed
Utilities: FileSystem: Added Exists() method
1 parent 23cdf8d commit 5c1dc07

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Utilities/IFileSystem/FileSystem.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,24 @@ public void CopyFile(string sourcePath, string destinationPath)
5959
destinationStream.Close();
6060
}
6161

62+
public virtual bool Exists(string path)
63+
{
64+
try
65+
{
66+
GetEntry(path);
67+
}
68+
catch (FileNotFoundException)
69+
{
70+
return false;
71+
}
72+
catch (DirectoryNotFoundException)
73+
{
74+
return false;
75+
}
76+
77+
return true;
78+
}
79+
6280
public abstract string Name
6381
{
6482
get;

0 commit comments

Comments
 (0)