Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Kept the name same TryStat
  • Loading branch information
Biroj committed Jan 22, 2024
commit 3f0980a00a4251d7e5127acd2982721c83b47fb1
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private static bool LastWriteTimesHaveChanged()

if (s_rootStoreFile != null)
{
_ = TryStatFile(s_rootStoreFile, out DateTime lastModified);
_ = TryStatFile(s_rootStoreFile, out DateTime lastModified, out _);
if (lastModified != s_fileLastWrite)
{
return true;
Expand Down Expand Up @@ -366,16 +366,13 @@ private static string[] GetRootStoreDirectories(out bool isDefault)
return directories;
}

private static bool TryStatFile(string path, out DateTime lastModified)
=> CallStat(path, Interop.Sys.FileTypes.S_IFREG, out lastModified, out _);

private static bool TryStatDirectory(string path, out DateTime lastModified)
=> CallStat(path, Interop.Sys.FileTypes.S_IFDIR, out lastModified, out _);
=> TryStat(path, Interop.Sys.FileTypes.S_IFDIR, out lastModified, out _);

private static bool TryStatFile(string path, out DateTime lastModified, out (long, long) fileId)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: only keep 1 TryStatFile and update the caller that ignores fileId by passing it out _ as the last argument.

=> CallStat(path, Interop.Sys.FileTypes.S_IFREG, out lastModified, out fileId);
=> TryStat(path, Interop.Sys.FileTypes.S_IFREG, out lastModified, out fileId);

private static bool CallStat(string path, int fileType, out DateTime lastModified, out (long, long) fileId)
private static bool TryStat(string path, int fileType, out DateTime lastModified, out (long, long) fileId)
{
lastModified = default;
fileId = default;
Expand Down