IFolder.Path doesn't actually return the Path from the platform

Jan 24, 2014 at 1:40 AM
Edited Jan 24, 2014 at 1:45 AM
I'm writing a WP8 app that calls native code and must supply a full path to it. But the PCLStorage library doesn't expose the StorageFolder.Path property. There is an IFolder.Path property, but it returns the empty string. Evidently the design is that it only returns the part of the path that is relative to the isolated storage root.

I'd like to either change that design, such that Path returns the Full Path, or add another property (perhaps "FullPath"?) that does expose this detail, so that I don't have to put #ifdef's in my code.

I'll also throw in there that FileSystem.Current.LocalStorage.GetFileAsync("some\full\path") produces an IFile instance whose Path property returns the full path. So making Path always return the full path instead of only when it was created a particular way would help the behavior be more consistent, IMO.

With your permission, Daniel, I'll proceed to make the change and send a pull request.
Coordinator
Jan 24, 2014 at 4:15 AM
I think the reason that the IsoStore implementations don't use the full path is because I didn't think it would be available. I don't think that would be allowed in Silverlight (unless using elevated trust) because that would reveal the user name, for example. The WinRT and System.IO based implementations should already use the full path.

If you can make the full path work correctly and consistently (even if it's only on Windows Phone and Silverlight still uses the partial path), that sounds great. In either case, if IFileSystem.GetFileFromPathAsync ever returns a file with a different Path than if the file was obtained via other methods, that is a bug we should fix.

Thanks,
Daniel
Jan 24, 2014 at 3:04 PM
Ah, it looks like IsolatedStorage itself does not expose the full path. But Windows Phone does expose this as part of its partial WinRT support.
So the 'fix' to allow Path to be correct on Windows Phone is evidently to have the WindowsPhone project implement its own file system rather than using isolated storage.
Jan 24, 2014 at 3:45 PM