Quicktime player and relative path
Ken Ray
kray at sonsothunder.com
Sun Jan 9 00:50:18 EST 2005
On 1/8/05 3:14 PM, "duane poncy" <tsalagi at elohigadugi.org> wrote:
>
> I can't find a satisfactory answer to this question either
> in the documentation or the archives.
>
> I have tried to build my first standalone with Rev 2.5. My
> program needs a seperate mp3 to function, but the player
> did not show up on my stack in the standalone.
>
> Back to the Rev program. The player shows up fine with an
> absolute path, but when I set a relative path, my player
> disappears. I thought at first that I was designating the
> path incorrectly, so I tried several different
> alternatives. No luck. The player only shows up with an
> absolute path. I even tried putting the mp3 in the same
> folder as the app. Didn't work. Can someone tell me what
> I'm doing wrong?
>
> btw, I am using Mac OSX.
Duane,
The problem with OS X is that the default directory is the folder that
contains the *engine* (inside the bundle in Contents/MacOS/), not the folder
that contains the *bundle* which is what appears to the user as the
application.
I use the following function in the preOpenStack handler of the stack that
is the one that is built into the standalone to always set the directory to
where the *bundle* is (for OS X), or where the executable is (for Windows),
or where the stack is (if running under the IDE):
on preOpenStack
set the directory to stsMyFolder()
end preOpenStack
function stsMyFolder
put the filename of this stack into tPath
set the itemDel to "/"
if (the platform = "MacOS") and isOSX() and \
(the environment <> "development") then
delete item -4 to -1 of tPath
return tPath
else
return item 1 to -2 of tPath
end if
end stsMyFolder
function isOSX
set the itemDel to "."
return (item 1 of the systemVersion >=10)
end isOSX
HTH,
Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com
More information about the use-livecode
mailing list