Skip to content

Commit

Permalink
Set the dates and times when creating files in the in-memory filesystem
Browse files Browse the repository at this point in the history
  • Loading branch information
halgari committed Apr 30, 2024
1 parent 305c8c4 commit 04e6fea
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ private InMemoryFileEntry InternalAddFile(AbsolutePath path, byte[] contents)
_files.Add(path, inMemoryFile);
directory.Files.Add(inMemoryFile.Path.RelativeTo(directory.Path), inMemoryFile);

inMemoryFile.CreationTime = DateTime.Now;
inMemoryFile.LastWriteTime = DateTime.Now;
return inMemoryFile;
}

Expand Down Expand Up @@ -288,6 +290,7 @@ private InMemoryFileEntry InternalCreateFile(AbsolutePath path, FileMode mode, F
if (inMemoryFileEntry is null)
throw new FileNotFoundException($"File \"{path.GetFullPath()}\" does not exist");

inMemoryFileEntry.LastWriteTime = DateTime.Now;
return inMemoryFileEntry;
}

Expand Down

0 comments on commit 04e6fea

Please sign in to comment.