classic application not reading file...
jan.decroos at groepvanroey.be
Tue Jun 29 03:17:30 CDT 2004
couldn't it be a solved bug ?
>I am a little lost trying to read a text file in classic enviroment.
>First I set the default folder to the stack folder, then I use a
>put pArray into URL tPath
>where pArray is a combined array and tPath is in the format "file:myApp
>prefs". This works fine, it writes the file ok, and the content is
>the trouble is trying to read the file. I use:
>get URL "file:myApp prefs"
>This works fine in MacOS X 10.3.4... no problem, it saves the file
>inside the bundle and load from there without any problem. Then I build
>the software to Mac Classic, it saves the file okay, but when I try to
>read the file it returns empty!!! the file is there, the content is
>right and it works on 10.3.4. I'll glue the routines below. I'll be
>very happy if anyone can spot this one out. I have a nice blogger
>client here, the xml-rpc routines working, the xml parsing working, and
>bugs on the silly preference system, man, so many places to be in
>also take notice that if the loadPrefs function cannot find the file it
>will return empty after showing "no content"... thats not the case,
>it's returning empty content but the file is there. It's like reading
>an empty file. This code works fine in 10.3.4
>my poor man's preference file system:
> set the itemDelimiter to "/"
> get item 1 to -2 of the effective filename of this stack
> set the defaultFolder to it
>function savePrefs pFile, pArray
> -- Save a pref file as a combined array.
> combine pArray by "=" and "&"
> put "file:" & pFile into tPath
> put pArray into URL tPath
> answer "Saving prefs" &&tPath -- debug helper
>function loadPrefs pFile
> -- Load a prefs file as a combined array
> answer "Loading Prefs" && pFile -- debug helper
> if there is a file pFile then
> put "file:" & pFile into tURL
> put URL tURL into tContent
> answer tContent
> return tContent
> answer "no content!"
> return empty
> end if
>Andre Alves Garzia ? 2004
>Soap Dog Studios - BRAZIL
More information about the use-livecode