Skip to content

Conversation

@daxian-dbw
Copy link
Member

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

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

Copy link
Contributor

@bergmeister bergmeister left a comment

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?

Copy link
Collaborator

@iSazonov iSazonov left a comment

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