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

/Documents/../Library Path on IOS #49

Open
mike-rowley opened this issue Aug 30, 2016 · 8 comments
Open

/Documents/../Library Path on IOS #49

mike-rowley opened this issue Aug 30, 2016 · 8 comments

Comments

@mike-rowley
Copy link

I am getting /var/mobile/Containers/Data/Application/22FAAA71-766D-45CD-9349-C16547432F7B/Documents/../Library as my path on IOS. The .. seems to create problems with other parts of the app trying to use the Path.

Why am I getting "/Documents/../Library" instead of just "/Library"? And how can I fix it?

Thanks
M

@MKahmen
Copy link

MKahmen commented Sep 16, 2016

Same for me. Any update on that?

Did you solve it @mike-rowley ?

@jaykannan
Copy link

Me too, what's the right away to use this?

@mike-rowley
Copy link
Author

@MKahmen and @FwJay I haven't found an answer at this point. Please let me know if you do find anything.

@MKahmen
Copy link

MKahmen commented Oct 17, 2016

@mike-rowley I used a Replace as a workaround. Very dirty, but no idea how I could solve this...

FileSystem.Current.LocalStorage.Path.Replace("/../Library", "")

@MKahmen
Copy link

MKahmen commented Oct 17, 2016

BTW this works (for whatever reason... path still has /../Library in it, but it's able to save the file:

IFolder rootFolder = FileSystem.Current.LocalStorage; 
IFolder folder = await rootFolder.CreateFolderAsync("TestFolder", CreationCollisionOption.OpenIfExists);
IFile file = await folder.CreateFileAsync("test.txt", CreationCollisionOption.ReplaceExisting);
await file.WriteAllTextAsync("test-string");

@mike-rowley
Copy link
Author

Thanks @MKahmen, I think the Path.Replace was the hack I used to keep things moving but I agree, very dirty.
The second post is what I am doing too but having the /../ causes problems trying to use that path anywhere else.

@JasonBro
Copy link

JasonBro commented Dec 13, 2016

I've used System.IO.Path.GetFullPath() to remove the .. entries in the past, but it's not available in a PCL

I thought about creating a pull request and changing all instances of Path.Combine in the platform specific code to something like:-

System.IO.Path.GetFullPath(System.IO.Path.Combine(currentPath, relativePath))

... but I didn't want to break everything!

Is anyone braver than me???

@leenephi
Copy link

leenephi commented Feb 7, 2017

@MKahmen Just started using this hack today hah. And thank goodness. XD

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

5 participants