specialFolderPath("engine") on Mountain Lion

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Gene
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 75
Joined: Wed Mar 09, 2011 6:48 pm
Location: Northern California

specialFolderPath("engine") on Mountain Lion

Post by Gene » Wed Mar 27, 2013 3:54 pm

I just started to migrate from my Snow Leopard machine to a new Mini with Mountain Lion, and I'm puzzling over a difference in the paths between the two systems.

Although LC reports back that the specialFolderPath("engine") on both Snow Leopard and Mountain Lion is "/Users/genelambert/Library/Application Support", it seems that there is no such literal path on MountainLion. With Leopard, I was using specialFolderPath("engine") in my code and placing files in the above path on my Mac for local development, and all was well.

Now, apparently, there is no such path as "/Users/genelambert/Library/Application Support" on Mac 10.8.3. The path to "Application Support" seems to be "Macintosh HD/Library." In short, "users/geneLambert" is now replaced by "Macintosh HD." So, using the specialFolderPath in my code with my external files in "Application Support" doesn't work. It would seem that using a workaround of having to code for specialFolderPath for deployment on a device, while having to write separate code for a literal path to develop on the Mac is pretty messy.

Is there some special folder path for specialFolderPath that will resolve this elegantly? I think Windows goofed up their user interface by using an enigmatic scheme of virtual paths along about Windows 7. It's looks like Mac has gone for a similar "improvement" in the user experience.

Thanks in advance for your thoughts on this - Gene

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: specialFolderPath("engine") on Mountain Lion

Post by sturgis » Wed Mar 27, 2013 4:04 pm

"engine" is only supported for ios and android.

If you look in the dictionary for specialfolderpath you can see which things are available for each OS

For example:
For Mac OS X systems:
• Home - The current user's home directory (e.g. "/Users/Fred").
• Desktop - The user's Desktop folder.
• System - The Apple Menu Items folder inside the System Folder.
• Control - The active System Folder.
• Fonts - The system Fonts folder.
• Preferences - The Preferences folder inside the user's Library folder.
• Temporary - For storage of temporary files.
• Documents - For user documents.
• Support - For application data. -- this is probably what you want.
However, just looked and the folder is where it says it is, but Library is a hidden folder. If you open finder use the "go" menu to "go to folder" and paste in the path to the application support folder, it will take you right there. YOu can also change finder settings so that the hidden folders show up. I'm surprised engine works at all for me on osx since its not listed as applicable, but I wouldn't trust it and would use specialfolderpath("support") instead. (which points at exactly the same place)

Gene
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 75
Joined: Wed Mar 09, 2011 6:48 pm
Location: Northern California

Re: specialFolderPath("engine") on Mountain Lion

Post by Gene » Wed Mar 27, 2013 5:25 pm

"engine" is only supported for ios and android.
I guess didn't state my question clearly. In fact, I am deploying to a mobile device, and this question came out of trying to transfer a working app from development on Snow Leopard to Mountain Lion. Also from the dictionary, "'engine' is only supported for ios and android." So, I thought that specialFolderPath was particularly useful for coding the same path for both running on the Mac, and when testing/deploying to a device. At least, that's what worked fine on my Leopard OS Mac.

What I am saying is that, previously, I used specialFolderPath("engine") in the code, and placed my external files in "Application Support" The app found the files when testing on the Mac (Snow Leopard), and after sending it to a physical Android device. This was all good. Now, on Mountain Lion, I place the external files in the Application Files folder, and the stack can't find them. Then, I presume that if I code for a relative path that works on the Mac, then that path won't work when I send it to the device.

Maybe a simple way of stating my question/problem is that specialfolderpath("engine") as given from within LC is /Users/genelambert/Library/Application Support - on both versions of the operating system. However, that path does not exist on OS 10.8.3, but does (and works for the app) on 10.6. On my machine, Library isn't hidden - it's just not in the path given by specialfolderpath on Mountain Lion. It is, however, on Snow Leopard. So, do I have to code with two separate paths - one for local testing the Mac, and another for the device? I guess that's the trick if I'm going to use the new computer and OS.

Thanks for the information, though. I hadn't looked into the dictionary entry for specialFolderPath for awhile because didn't think I needed to since specialFolderPath("engine") was working OK for my app on Snow Leopard.

Cheers,

Gene

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7229
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: specialFolderPath("engine") on Mountain Lion

Post by jacque » Wed Mar 27, 2013 6:41 pm

The special folder "engine" refers to the one that holds the app itself. Where that app is located varies by device, and during testing, the temporary app location varies by OS version (as you found out.) I'm surprised too that "engine" pointed to the Library path in Snow Leopard, I wouldn't have thought it would.

What I do is create a function that returns the folder path to the files. I check "the environment" and if it is "development" then I look in the folder that contains the main stack, otherwise I use one of the specialFolderPath folders. As long as I keep all the files in the same place as the main stack on disk, I don't need to move anything.

Code: Select all

function pathToFiles
  if the environment = "development" then
    set the itemdel to slash
    return item 1 to -2 of the effective filename of this stack & slash
  else
    return specialFolderPath("engine") & slash
  end if
end pathToFiles
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Gene
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 75
Joined: Wed Mar 09, 2011 6:48 pm
Location: Northern California

Re: specialFolderPath("engine") on Mountain Lion

Post by Gene » Wed Mar 27, 2013 10:33 pm

That's it, jacque, you drove a stake into the heart of my question. I was thinking that I would need to generate something that would distinguish the app's environment and specify the paths accordingly, but it's not necessary now. I appreciate you sharing your simple and elegant function. I guess I got lulled into thinking that specialfolderpath points at a usable external folder for development, since it worked that way on my Windows 7 computer and Leopard before I got to Mountain Lion.

Gene

Post Reply

Return to “iOS Deployment”