Load a sound file

How would you use a choose file dialog to get a file and store it to the application. Such as, say you choose a sound file, how would you add that to the application so you can use NSSound to play the file. And then when the app quits and you relaunch you still have that file available to use.

You’d have to use UserDefaults to save that chosen file’s path to a string or URL, then save that on quit. When the app is relaunched you would load it from the .plist file. At least that’s how I would do it. If the file moves or is not available, you’d want to check for that. If you want to actually COPY the file into the app, well that’s unusual. But you could use NSFileManager to copy the file to a resources folder. Then when the app starts, you’'d scan that folder for files/paths to files and add them to a list.

so if I was to just save the path of the file as a string how do I go about calling forth the actual file so that i can play it using NSSound?