Skip to content

Commit

Permalink
Merge pull request #52 from Nexus-Mods/set-datetimes-on-in-memory-fil…
Browse files Browse the repository at this point in the history
…esystem

Set the Created/Modified dates when creating in-memory file system entries
  • Loading branch information
halgari authored Apr 30, 2024
2 parents 305c8c4 + ba1e7e7 commit 4bd6131
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.UtcNow;
inMemoryFile.LastWriteTime = DateTime.UtcNow;
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.UtcNow;
return inMemoryFileEntry;
}

Expand Down

0 comments on commit 4bd6131

Please sign in to comment.