Page 1 of 1
mac and window file paths
Posted: Fri May 14, 2010 3:09 am
by no1g8tor
I just got a Macbook Pro and switched from windows and I have a stand alone issue??
THis is some code to pull data from text files in a folder called "Tracks" and it works in developer mode in Mac and PC but when I "Compile" it, the mac version cant find the data but the windows standalone works fine. Why would it work in "developer" mode but now when its compiled.
put defaultFolder into foldloc
put fld"trackname" into trackselect
put foldloc & "/" & "Tracks" &"/" & trackselect & ".txt" into tfile
open file tfile for read
read from file tfile at 1 until EOF
put it into tdata
close file tpath
Thanks for your help in advance.
Mike
Re: mac and window file paths
Posted: Fri May 14, 2010 3:43 am
by mroam
I had a similar problem lately (file i/o works in development environment but not in mac version of standalone), and I found a strange work around. The solution involved changing no code: instead I make my standalones one at a time. First make a mac standalone only, then quit and go back and make the pc standalone. For some reason this was enough to create a better mac standalone.
I did this several times during my development process, using various macs as my development environment, with revolution studio 4.0. Whenever I tried making both standalones at the same time, the mac standalone wouldn't do file i/o properly. I don't know why, but I was glad I found a fix.
(I couldn't test whether the PC standalone had proper file i/o since I only had a mac handy.)
Good luck
--Mike
Re: mac and window file paths
Posted: Fri May 14, 2010 10:08 am
by Klaus
Hi Mike (1

) ,
what IS the defaultfolder in your standalone?
Please note that "the defaultfolder" is different (or at least not what you might exspect) on Windows and Mac!
After the app starts "the defaultfolder" is the folder where the APP/EXE resides!
But since APPs on the Mac are actually folders, I guess all your files and/or the folder "Tracks" are INSIDE of the app package:
Code: Select all
Your nice Mac-app.APP
Contents
MacOS
Your nice Mac-app
## the mainstack turned into standalone!
Tracks
## Folder!
Externals
...
So maybe you should implement a platform switch, if your files and folders are INSIDE of the app package:
Code: Select all
...
switch the platform
case "MacOS"
put the filename of stack "name of mainstack here" into thefile
set itemdel to "/"
put "Tracks" into item -1 of thefile
put "/" & trackselect & ".txt" after thefile
put url("file:" & thefile) into tdata
break
case "Win32"
...
Hope that helps...
Best
Klaus
Re: mac and window file paths
Posted: Fri May 14, 2010 3:33 pm
by no1g8tor
Thanks for the replies. I did try to compile by its self and still no go.
The Main Folder name(on my desktop currently) is "The Winner System". Inside that folder is the Program(app) and a folder called "tracks" that have the text files.
Re: mac and window file paths
Posted: Fri May 14, 2010 11:09 pm
by Curry
have it answer the folder on startup and have a look at the path the standalone shows.
Re: mac and window file paths
Posted: Sat May 15, 2010 10:09 am
by jmburnod
Hi,
I use this script to build un folder path from a stack or from a standalone
gPathNec is a global variable it contains the path of a folder "LeNecessaire"
The main folder contains the standalone or the stack and the folder "LeNecessaire"
Code: Select all
on FaitPathNec
global gPathNec
put the filename of this stack into bufPath
put bufPath into gPathNec
put the environment into pEnv
put the itemdel into OID
set the itemdel to "/"
put the num of items of gPathNec into nbF
if the platform = "MacOS" then
if pEnv = "standalone application" then
delete item (nbF-3) to nbf of gPathNec
end if
if pEnv = "development" then
delete last item of gPathNec
end if
else
delete last item of gPathNec
end if
set the itemdel to OID
put "/"&"LeNecessaire" after gPathNec
end FaitPathNec
Best
Jean-Marc
Re: mac and window file paths
Posted: Sat May 15, 2010 1:45 pm
by Klaus
Hi,
no1g8tor wrote:Thanks for the replies. I did try to compile by its self and still no go.
The Main Folder name(on my desktop currently) is "The Winner System". Inside that folder is the Program(app) and a folder called "tracks" that have the text files.
OK in this case this SHOULD work
Code: Select all
...
## Get the folder with the APP/EXE in it, "Total Winner System" in your case
put the effective filename of stack "name of mainstack /standalone here..." into tFile
## tFile on Mac-> ../Total Winner System/Mac.app/Contents/MacOS/the_stack_with_standalone
## tFile on Win-> ../Total Winner System/Win.exe
set itemdel to "/"
if the platform = "MacOS" then
delete item -4 to -1 of tFile
## Results in ../Total Winner System
else
delete item -1 of tFile
## Results in-> ../Total Winner System
end if
put "/Tracks/" & trackselect & ".txt" after tFile
put url("file:" & tFile) into tdata
## Done!
...
Hope this helps!
Best
Klaus
P.S.
I use "the effective filename of stack xyz" here since this will also work with substacks!
Re: mac and window file paths
Posted: Mon May 17, 2010 3:59 pm
by no1g8tor
thanks so much for the replies. I am out of town and will try later in the week but wanted to let you know I got them. If I need any more help I will post.
Thanks for making this a great forum.
Mike