FileManager contentsOfDirectory(at: giving paths not in the original directory

When testing on device with ios 13 beta 4 on an ipad.

I obtained a URL for application support using:

fileManager.url(for: .applicationSupportDirectory, in: .userDomainMask, appropriateFor: nil, create: true)


which looks like

/var/mobile/Containers/Data/Application/<UUID>/Library/Application%20Support/

then, I append my main bundle identifier and a path component for my feature.


I then use the file manager to iterate the contents of the directory.

fileManager.contentsOfDirectory(at: directory, includingPropertiesForKeys: nil, options: [.skipsHiddenFiles, .skipsPackageDescendants, .skipsSubdirectoryDescendants]

however, the urls in the directory come out like

/private/var/mobile/Containers/Data/Application/<UUID>/Library/Application%20Support/bundleid/feature/filename


(with the extra /private in the front)

Due to this, my code that extracts the relative path to the file from the directory fails.


Why is this extra /private in the front? How do I get it to not be there, or be in the original dir?

Is there a more reliable way to get a relative url knowing the container & path?