In my code I copy 2 executable files to the Desktop (selected via NSOpenPanel). I am using Xcode 13.2.1
On an Intel Mac this works as expected and I see the 2 files on the desktop as expected.
On an M1 Mini I see a link file called Developer. When I click it the 2 copied files are revealed. If I only copy one file then it shows as expected. This happens in both Monterey and Big Sur but only on the M1.
Saving the files to any other folder does not create the Developer link, only when Desktop is chosen from the selection dialog.
When I execute ls ~/Desktop
from the command line I see only the 2 files, so I am thinking that Developer is some artefact of the Finder.
Is the creation of this 'Developer' link a System/Finder setting and why would it only happen on the M1 machine?
@IBAction func exportUtils(_ sender: Any)
{
let panel = NSOpenPanel()
panel.message = NSLocalizedString("Export Command Line Tools", comment: "")
panel.prompt = NSLocalizedString("Choose", comment: "")
panel.canChooseFiles = false
panel.canChooseDirectories = true
panel.canCreateDirectories = true
panel.showsHiddenFiles = true
panel.isExtensionHidden = false
let result = panel.runModal()
if result != .OK { return }
guard let dir = panel.directoryURL else { return }
let dest = dir.path
let fileManger = FileManager.default
for file in ["a", "b"] {
do {
let target = dest + "/" + file
if fileManger.fileExists(atPath: target) {
try fileManger.removeItem(atPath: target)
}
guard let util = Path.executablePath(forExecutable: file) else { return }
try fileManger.copyItem(atPath: util, toPath: target)
Logger.instance.log("Copied: " + file + " to: " + dest)
} catch {
Logger.instance.log("Failed to copy: " + file + " to: " + dest)
}
}
}
code-block