How to get All paths for files in Documents directory?

前端 未结 3 922
名媛妹妹
名媛妹妹 2020-12-13 21:41

I usually get paths by using NSBundle.

But, NSBundle does not contain Documents folder.

How to get All paths(or names) for files in

3条回答
  •  天命终不由人
    2020-12-13 22:22

    Here is in swift.
    Print statement will print all available paths

    func getDocumentsDirectory() -> URL {
        let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
    print("Paths - \(paths)")
        let documentsDirectory = paths[0]
        return documentsDirectory
    }
    

提交回复
热议问题