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

Minor update on 'GetFileSystemItem'#6984

Merged
iSazonov merged 1 commit into
PowerShell:masterPowerShell/PowerShell:masterfrom
daxian-dbw:attrdaxian-dbw/PowerShell:attrCopy head branch name to clipboard
Jun 5, 2018
Merged

Minor update on 'GetFileSystemItem'#6984
iSazonov merged 1 commit into
PowerShell:masterPowerShell/PowerShell:masterfrom
daxian-dbw:attrdaxian-dbw/PowerShell:attrCopy head branch name to clipboard

Conversation

@daxian-dbw

@daxian-dbw daxian-dbw commented Jun 4, 2018

Copy link
Copy Markdown
Member

PR Summary

Submit minor updates to GetFileSystemItem.
I missed the review for #6909, and use this PR to address a few comments from myself :)

PR Checklist

@bergmeister bergmeister left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.
On a minor note: Would it not be more readable to determine if the file/directory exists as follows:

private static bool FileOrDirectoryExists(string path)
{
   return (Directory.Exists(path) || File.Exists(path));
}

Or is it a performance optimisation to just check the attributes instead?

@iSazonov iSazonov left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@daxian-dbw Thanks! Good catch!

@bergmeister Yes, the idea was to reduce kernel calls and extra path normalizations. Also we need process exceptions.

@iSazonov iSazonov merged commit 0b32d0c into PowerShell:master Jun 5, 2018
@daxian-dbw daxian-dbw deleted the attr branch June 5, 2018 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.