IoException error 1

How can my app make an IOException for the ApplicationSupport folder?

The following code has been working for many moons:

[code]’'locate the application support folder
LogItemToConsole(CurrentMethodName)
dim theFolderitem as FolderItem = SpecialFolder.ApplicationData

dim theAppname as String
#if TargetMacOS then
theAppname = app.getMyAppName
#Else
theAppname = “test”
#Endif
if theAppname = “” then Return nil
if theFolderitem <> nil and theFolderitem.Exists then theFolderitem = theFolderitem.Child(theAppname)
if theFolderitem = nil then Return nil

'create new folder for application
if not theFolderitem.Exists then
try
theFolderitem.CreateFolder
catch err as IOException
MessageDialog.Show("There was a problem with creating the folder for the error logs! Error: " + str(err.ErrorNumber))
end try
end if

if globals.theErrorLog <> nil then
if theFolderitem <> nil then
'everyting okay
else
MessageDialog.Show “There was a problem with getting the location of the error logs.”
end if
end if

LogItemToConsole(CurrentMethodName + " done")
Return theFolderitem
[/code]
First there is an unhandled NOE. The app doesn’t quit but continues. Then there is an error message on the CreateFolder and the error number is a 1. The error descriptions at osstatus.com aren’t very helpful.

Why does the app not quit? What is happening here?

macOS 10.15.4 for the user, Xojo 2019r3.

Bump

No ideas?

I have no idea what’s going wrong. But is the string returned by “app.getMyAppName” correct?

Maybe there’s a error in this function under Catalina?

FYI: I have tested your code under 10.15.4 - standard user - debug mode - Xojo 2019r3 - no error.

Good luck for debugging.

app.getMyAppName is quite simple:

[code]dim debug as String = “.debug”

dim Appname as String = app.ApplicationNameMBS
if Appname.Right(debug.Length) = debug then Appname = Mid(Appname, 1, Appname.Length - debug.Length)

Return Appname[/code]

The function is used all over the place in all my apps. Unfortunately, only one user has the problem. I’ve made him a version where CreateFolder has a fallback of a shellscript with mkdir.

Now I have also tested with the function “getMyAppName” included MBS(18.2) - no errors.

One possibility: Error 1 = Permission denied
If I revoke the write permissions of a simulated destination folder, error 1 is returned at “theFolderitem.CreateFolder” (Permission denied).

But if it would be a permission error, the shell script (mkdir) should not run either …