Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.IO.File.Exists and System.IO.Directory.Exists don't behave as expected on UWP #25

Closed
jasells opened this issue Sep 6, 2018 · 2 comments

Comments

@jasells
Copy link
Contributor

jasells commented Sep 6, 2018

Basically, line #62 in StorageFile.cs
public bool Exists => this.Originator != null && File.Exists(this.Path);
and a similar check in StorageFolder.cs don't work as expected on UWP due to differences in app-based permission scheme in UWP. The .Exists propery appears to always return false, even is the app has permission to the directory.

I have a fork that simply removes the System.IO.File/Directory.Exists call and rely only on the Windows.Storage API to gaurantee that a Windows.Storage.StorageFile/StorageFolder can only be created ( != null) if the file/folder exists. This seems to be the case, and the intent of this API.

This is what I changed it to, and it seems to work in my testing:

public bool Exists => this.Originator != null;

Here's my PR.

Here's the original issue that lead to this.

@jasells jasells changed the title System.IO.File.Exists and System.IO.Directory.Exists don't behave as epxect on UWP System.IO.File.Exists and System.IO.Directory.Exists don't behave as expected on UWP Sep 14, 2018
jamesmcroft added a commit that referenced this issue Sep 14, 2018
@jamesmcroft
Copy link
Member

@jasells your changes are available in the NuGet packages currently going through validation. The new version number will be 1.3.18257.3.

I will leave this issue open until you're happy that your fix is available and working. Thanks for the PR!

@jasells
Copy link
Contributor Author

jasells commented Oct 26, 2018

Apologies for not closing this sooner! It is fixed with 1.3.1857.3

@jasells jasells closed this as completed Oct 26, 2018
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

No branches or pull requests

2 participants