FileManager Expert Help, Help

I think I'm in FileManager hell.... I've been trying to work with an example app from Apple called -"NavigatingHierarchicalDataUsingOutlineAndSplitViews" in the Apple docs.
They load their example directory /Applications to view with the browser....
let appsURLs = FileManager.default.urls(for: .applicationDirectory, in: .localDomainMask)
addFileSystemObject(appsURLs[0], indexPath: IndexPath(indexes: [0, 0]))

addFileSystemObject I believe is their own function they wrote. I think the FileManager.default.urls loads an array or dictionary of URL's for all subdirectories and files?

This works, but when I try to change it to a different directory (even one like .desktopDirectory, .userDomainMask) it barfs....

what I really want is to be able to read a directory like file:///Users/me/myChoice_dir and have the manager create the same structure of URLs from my user directory myChoice_dir....

When I do this it barfs on every approach I've tried. I've even created an array of URL's.
Now when I drag and drop the myChoice_dir, everything works just fine.... Anyone have any ideas on this? Am I being prohibited from the Application trying to read my directories I've created in my /Users/me/directories?

Thanks in advance. -Jim

I'll try to explain it better tomorrow with a better example. Your right, I don't have a clue what ellipses are or how to use them...
FileManager.default.urls(for: .applicationDirectory, in: .localDomainMask), What I'm looking for is an equivalent function.
FileManager.default.urls(for: "/Users/me/somedir/") which would be equivalent. Yes, convert the string of the directory I'm looking for and produce something very identical.
Thanks, I'll try and show more information tomorrow.

FileManager.urls(for:in:) is only intended for specific common directories, such as the applications folder and desktop folder. If you want to retrieve the top-level contents of a directory, use FileManager.contentsOfDirectory(at:includingPropertiesForKeys:options:). Otherwise, use enumerator(at:includingPropertiesForKeys:options:errorHandler:) to recursively enumerate a directory.

Also, please learn how to use markdown.

Thank you Peter, I'll look at this tomorrow in more detail. It's appreciated.

Terms of Service

Privacy Policy

Cookie Policy