Giter Club home page Giter Club logo

Comments (7)

princegeovision avatar princegeovision commented on May 16, 2024 4

Folder.documents, and Folder.library are macOS only for some reason.
I use extension to add them back to use in iOS. maybe you can do the same.

#if os(iOS)
extension Folder {
    
    static var documents: Folder? {
        let urls = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
        guard let url = urls.first else { return nil }
        return try? Folder(path: url.relativePath)
    }
    /// The current user's Library folder
    static var library: Folder? {
        let urls = FileManager.default.urls(for: .libraryDirectory, in: .userDomainMask)
        guard let url = urls.first else { return nil }
        return try? Folder(path: url.relativePath)
    }
}
#endif

from files.

thejeff77 avatar thejeff77 commented on May 16, 2024 3

Awesome. Thanks!

I'd kind of like to get a comment from @JohnSundell - I'd be interested why this was made only for macOS, and if it was done for good reason. I'd like to fix it in the library itself if possible. Thanks for commenting, I didn't take the time to look at the code :)

from files.

thejeff77 avatar thejeff77 commented on May 16, 2024

@princegeovision do both of these work? I didn't know there was a library folder on iOS.

from files.

princegeovision avatar princegeovision commented on May 16, 2024

Well, I never use "library" as well, but apparently it has.

library = Folder(name: Library, path: /Users/xxxxxxxxxx/Library/Developer/CoreSimulator/Devices/AC788231-BC9D-4C31-A32A-C580AEBD2659/data/Containers/Data/Application/0F0BC8D9-32D5-46B8-A396-1B9C79D3A5EA/Library/)
documents = Folder(name: Documents, path: /Users/xxxxxxxxxx/Library/Developer/CoreSimulator/Devices/AC788231-BC9D-4C31-A32A-C580AEBD2659/data/Containers/Data/Application/0F0BC8D9-32D5-46B8-A396-1B9C79D3A5EA/Documents/)

from files.

ducnguyenenterprise avatar ducnguyenenterprise commented on May 16, 2024

@princegeovision You can make a pull requet, hope @JohnSundell can make it the offical

from files.

 avatar commented on May 16, 2024
let documents = try! Folder.home.subfolder(named: "Documents")

from files.

JohnSundell avatar JohnSundell commented on May 16, 2024

Feel free to make a PR if you'd like to see these APIs added on iOS 👍 Files was originally developed with a heavy focus on macOS, since it was primarily built for command line tools and scripting, which is why some of its APIs are a bit Mac-centric.

from files.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.