My macos swift gets an error when it tries to write to folder: /users/me/Test/mv_data/
I can manually write to a file there without problem.
I set permissions from /users/me/ with this: sudo chmod -R a=rwx Test
Here’s my system…
-
I run my python script on my macos which opens my python gui
-
I press START on the gui which runs my macos swift app executable
-
swift app tries to write a file into Test/ but gets this error…
Error creating session directory: You dont have permission to save the file 2024-04-29T113328 in the folder mv_data.
Start session mv /Users/dbell/Test/mv_data/2024-04-29T113328
Start session /Users/dbell/Test/mv_data/2024-04-29T113328
Write to file:///Users/dbell/Test/mv_data/2024-04-29T113328/parameters.txt failedWrite to file:///Users/dbell/Test/mv_data/2024-04-29T113328/registers.txt failed
Here is swift app code…
let pathString = dataDirectoryPath.path + "/(serviceDirectoryName)"
do {
try FileManager.default.createDirectory(atPath: pathString, withIntermediateDirectories: true, attributes: nil)
} catch {
print(error.localizedDescription)
if logit(level: 0) { logit(LoggerCategory.warn, "Error setting up file captures: (error.localizedDescription)") }
}
let sessionDirectory = (URL(fileURLWithPath: pathString).appendingPathComponent(sessionDirectoryName)).path
do {
try FileManager.default.createDirectory(atPath: sessionDirectory, withIntermediateDirectories: true, attributes: nil)
} catch {
if logit(level: 0) { logit(LoggerCategory.warn, "Error creating session directory: (error.localizedDescription)") }
}