Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -1218,10 +1218,10 @@ private FileSystemInfo GetFileSystemItem(string path, ref bool isContainer, bool
path = NormalizePath(path);
FileInfo result = new FileInfo(path);

// FileInfo.Exists is always false for a directory path, so we check the attribute for existence.
var attributes = result.Attributes;
// FileInfo.Exists is true for files but false for directories
// so we check attributes directly.
bool exists = (int)attributes != -1;
if ((int)attributes == -1) { /* Path doesn't exist. */ return null; }

bool hidden = attributes.HasFlag(FileAttributes.Hidden);
isContainer = attributes.HasFlag(FileAttributes.Directory);

Expand Down Expand Up @@ -1250,10 +1250,9 @@ private FileSystemInfo GetFileSystemItem(string path, ref bool isContainer, bool
// also return the object
if (!isContainer)
{
if (exists && (!hidden || Force || showHidden || filterHidden || switchFilterHidden))
if (!hidden || Force || showHidden || filterHidden || switchFilterHidden)
{
s_tracer.WriteLine("Got file info: {0}", result);

return result;
}
}
Expand All @@ -1270,10 +1269,9 @@ private FileSystemInfo GetFileSystemItem(string path, ref bool isContainer, bool

// if "Hidden" is specified in the attribute filter dynamic parameters
// also return the object
if (exists && (isRootPath || !hidden || Force || showHidden || filterHidden || switchFilterHidden))
if (isRootPath || !hidden || Force || showHidden || filterHidden || switchFilterHidden)
{
s_tracer.WriteLine("Got directory info: {0}", result);

return new DirectoryInfo(path);
}
}
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.