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 Directory iOS #57

Closed
ghost opened this issue May 16, 2018 · 1 comment
Closed

Documents Directory iOS #57

ghost opened this issue May 16, 2018 · 1 comment

Comments

@ghost
Copy link

ghost commented May 16, 2018

Hi,

There is API for the docs directory, but it's not public. Any reason for this?

The 'home' API seems to work as follows

let home = Folder.home.path
macOS: /Users/robertnash/
iOS: /Users/robertnash/Library/Developer/CoreSimulator/Devices/91BA8C3F-9B72-42AB-89D1-6401B183E5EB/data/Containers/Data/Application/

The docs directory is a little deeper.

let documentDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
macOS: file:///Users/robertnash/Documents/
iOS: file:///Users/robertnash/Library/Developer/CoreSimulator/Devices/91BA8C3F-9B72-42AB-89D1-6401B183E5EB/data/Containers/Data/Application/A568FA48-5C29-4368-9123-008EAC5DA331/Documents/

Would be good to get the applicationSupportDirectory too

let storeDirectory = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first!
macOS: file:///Users/robertnash/Library/Application%20Support/
iOS: file:///Users/robertnash/Library/Developer/CoreSimulator/Devices/91BA8C3F-9B72-42AB-89D1-6401B183E5EB/data/Containers/Data/Application/A568FA48-5C29-4368-9123-008EAC5DA331/Library/Application Support/
@ghost
Copy link
Author

ghost commented May 16, 2018

Ah ha!

let system = FileSystem()
let path = system.homeFolder.path
print("home: \(path)")

Output

home: /Users/robertnash/Library/Developer/CoreSimulator/Devices/91BA8C3F-9B72-42AB-89D1-6401B183E5EB/data/Containers/Data/Application/84D3A5EB-7DFE-4E6B-8E06-6784588CF3FA/

Then

let folder = try! Folder(path: home)
let documents = try! folder.subfolder(named: "Documents")
print("doc: \(documents.path)")

Output

doc: /Users/robertnash/Library/Developer/CoreSimulator/Devices/91BA8C3F-9B72-42AB-89D1-6401B183E5EB/data/Containers/Data/Application/F5FBDBEE-BDA6-4420-92BE-4D17C355C056/Documents/

@ghost ghost closed this as completed May 16, 2018
@ghost ghost mentioned this issue May 16, 2018
This issue was closed.
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

0 participants