Mac SpecialFolder problem in the Finder

I have come across another problem with SpecialFolder.ApplicationData. I have just moved back to using my MacBook Pro running OS Monterey version 12.4 after working on my Project for the last month on my old iMac with a big screen running OS Catalina v10.15.7. I need the Project on my laptop as I am going to London for a few weeks. I am using Xojo2022r1.1

The original slight problem I had on the iMac was finding a place to save my files externally and being able to access them - all .txt files - in the Finder. Although I knew they were going in a folder called xojoData in a folder called Application Support inside another folder called Library inside my home folder iMac27, I was never able to see this in the Finder or access it.

No problem, I could find xojoData using the Xojo Command-F find facility and looking for a folder called xojoData. I then created an alias on my desktop so I could access, check and modify the .txt files if I wanted to without doing it through Xojo all the time. I have copied the entire xojoData folder to my laptop ready to put it in the right place on the hard drive.

Of course I could not identify the right folder in the Monterey Finder so I used this code from a method called folderCheck in my Project:

fD = SpecialFolder.ApplicationData
If fD = nil or not fD.exists then
  MessageBox("Problem with folderCheck, fD")
fE = fD.Child("xojoData")
if fE = nil or not fE.exists then
  MessageBox("Problem with folderCheck, fE")
fF = fE.child("crosswords")
if fF = nil or not fF.exists then
  MessageBox("Problem with folderCheck, fF")

There was no problem with the ApplicationData. The folder xojoData could not be found but was created, then there was a problem with the next folder. I know the xojoData folder was created because I ran the code again and there was no problem until the third folder, crosswords.

Well I suppose I can get round this by importing my whole folder and file structure into Xojo and spitting it out again on my laptop. However, in Monterey, I can’t even find the folder xojoData using the find facility so I can’t access it or its contents any way except via Xojo.

Monterey seems to be preventing me from seeing the Library and the Application Support folders or at least I can see a Library folder inside the Laptop hard drive and it has an Application Support folder in it but that folder has no visible xojoData folder inside it and anyway, it is in the wrong place. From what I know from working on my iMac, the Library folder should be inside my user home folder, with Application Support/xojoData inside that.

Is there some way I can make my file structure visible and accessible via the Finder or via the search facility as I have managed to do on my iMac? Thanks if you can help! Steve

I’m not sure what ApplicationData is meant to be used for. Me, I use SpecialFolder.Documents.

That’s what I did when I started but I was forever being asked to give permission for access to the Documents folder so I was advised on this forum to use SpecialFolder.ApplicationData, which confusingly seems to relate to an apparently invisible folder called Application Support, as opposed to hundreds of other visible folders called Application Support dotted around all over the place.

If you press SHIFT-CMD and period in the Finder it should show files and folders that are normally hidden.

If you hold down OPTION and select the Go menu in the Finder you should have an option to open your Library folder.

If you choose ‘Go to Folder’ from the Go menu in the Finder and enter the following path it should open your Library folder.

1 Like

Brilliant, thanks Kevin. I’ve found the Library folder with Application Support/xojoData in it, have transferred all my files, made an alias on my desktop and everything is working fine again. Cheers!

a folder called Application Support inside another folder called Library inside my home folder iMac27, I was never able to see this in the Finder or access it.

Go to finder menu, choose Go
When the menu drops down, press ALT
Library appears there.
Open that, and Application Support is visible.

If your app cannot see or use the files and folders revealed here, then it is running translocated, with its own unique set of folders - a kind of pseudo sandboxing.
I can imagine this might happen with debug builds.

These text files… if you only ever want to read from them, just drag them into your project.
At runtime, you can refer to the files contents as if they were string variables.

A text file called stuff.txt dragged into the project can be treated as a string constant called stuff

msgbox Stuff

Files you want your customers to be able to access could go into Application Support (although that is hard for them to access) , or it can go into specialfolder.documents
To get things there its a good idea to ask the user for a folder name, and store things in it.
(Save their folder choice in one of your preferences)

If you want to allow the use to see the application support folder stuff, issue a call to
launch the folderitem which is yours

Ive been using this code from Sam Rowlands recently:

  #if targetMacOS then
    // --- Patch to open a Xojo folderitem using [[NSWorkspace sharedWorkspace] openURL:]
    //     July 28th 2019 - Sam Rowlands
    declare function NSClassFromString lib "Foundation" ( inNSClassName as CFStringRef ) as integer
    declare Function NSURLfileURLWithPathIsDirectory lib "AppKit" selector "fileURLWithPath:isDirectory:" _
    (NSURLClass as integer, path as CFStringRef, directory as boolean) as integer
    declare function NSWorkspaceSharedWorkspace lib "AppKit" selector "sharedWorkspace" ( NSWorkspaceClass as integer ) as integer
    declare Function NSWorkspaceOpenURL lib "AppKit" selector "openURL:" ( NSWorkspaceSharedInstance as integer, inNSURL as integer ) as boolean
    return NSWorkspaceOpenURL( NSWorkspaceSharedWorkspace( NSClassFromString( "NSWorkspace" ) ), _
    NSURLfileURLWithPathIsDirectory( NSClassFromString( "NSURL" ), inFile.nativePath, ) )
    infile.launch true
    return true

Thanks Jeff, I am now able to find my xojoData folder. I’ll file that away for future reference. Once I get the dataFiles in good order it will be a good solution to simply drag the folders into the project. At the moment I read them into arrays for reference.

Or you may add a MenuItem that simply open your data working folder (wherever you store it) using


xojoData_FI is a reference to a FolderItem (in ApplicationData if this is where you place it).

Very useful at developing time.