I downloaded MacOSLib package but it’s longest than AppleScript. And I have to install one hundred functions to use only one. And it’s very hard to clean what I don’t use and keep what I use.
Do it in whatever way works best for you, but FYI, you can open the MacOSLib project, then copy just the “macoslib” folder into your project. If you don’t use any of it, it will not be compiled into your app. And if you need just one or two functions, it will compile only the methods/classes that it needs. That you have to install 100+ functions doesn’t really impact your final app size.
It would be nice if the IDE can do this as well. Load up the MacOSLib project, select a function or two and select “copy relevant/related code”…paste into a new project and off you go.
But that’s just it, it’s all enclosed in the macoslib folder, so there is nothing to wade through unless you need something. And if you need something, you have to wade through it no matter where it is, right?
Thank you. I repeat, macoslib is as long as AppleScript.
I did some try with the mdls shell command. It return a lot of different things when file, but “public.folder” if folder or “public.volume” for volume (which is a Directory in Xojo but not a Package).
Then if my FolderItem is a directory but mdls something else that “public.folder” or “public.volume” then it’s a package. Right ?
Sorry my earlier post may not be so clear, but there are circumstance where you may not need to actually test if a file is a package. For instance if you are trying to read an Apple pages document, you set up the file type so that your app can choose the file and then test to see if the opened file is a folder or not. Apple Pages can create files as either document packages or as flat binary files.
I have a program which synchronize files. The user can choose to manage Package as folder.
I have some Method to open folder, load or save file. I send them a folderItem, if this item is a folder then it’s the default folder (to load or to save in), if it’s a file, then the default folder is the parent file. I had trouble when the file I sent was a package, because the dialog show the package content (as a folder).
And I have another program which give info on a file or folder (modification date, size, and if package or not).