Skip to content

Commit

Permalink
Fix #6 non-existing directory creation when checking if a file exists
Browse files Browse the repository at this point in the history
  • Loading branch information
javidsho authored and aloneguid committed Jan 17, 2023
1 parent 671ae1b commit c18da07
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Stowage/Impl/LocalDiskFileStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private static string EncodePathPart(string path)

private Stream OpenStream(string path)
{
path = GetFilePath(path);
path = GetFilePath(path, false);

if(!SysIO.File.Exists(path))
return null;
Expand Down Expand Up @@ -161,7 +161,7 @@ private string GetFilePath(IOPath path, bool createIfNotExists = true)
rawPath = Path.Combine(_directoryFullName, extraPath);

dir = rawPath;
if(!Directory.Exists(dir))
if(createIfNotExists && !Directory.Exists(dir))
Directory.CreateDirectory(dir);
}

Expand Down

0 comments on commit c18da07

Please sign in to comment.