classic application not reading file...

Jan Decroos jan.decroos at groepvanroey.be
Tue Jun 29 04:17:30 EDT 2004


Andre,

couldn't it be a solved bug ?

see:
	http://www.runrev.com/revolution/developers/bugdatabase/show_bug.cgi?id=1468

(
and
	http://www.runrev.com/revolution/developers/bugdatabase/show_bug.cgi?id=379
)

Regards,
Jan


>
>Hi Folks,
>
>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 
>simple:
>
>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 
>right.
>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 
>trouble...
>
>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:
>
>on defaultToStackFolder
>   set the itemDelimiter to "/"
>   get item 1 to -2 of the effective filename of this stack
>   set the defaultFolder to it
>end defaultToStackFolder
>
>function savePrefs pFile, pArray
>   -- Save a pref file as a combined array.
>
>   defaultToStackFolder
>   combine pArray by "=" and "&"
>   put "file:" & pFile into tPath
>   put pArray into URL tPath
>   answer "Saving prefs" &&tPath -- debug helper
>end savePrefs
>
>function loadPrefs pFile
>   -- Load a prefs file as a combined array
>
>   defaultToStackFolder
>   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
>
>   else
>   answer "no content!"
>   return empty
>   end if
>end loadPrefs
>
>
>
>
>-- 
>Andre Alves Garzia ? 2004
>Soap Dog Studios - BRAZIL
>http://studio.soapdog.org
>




More information about the use-livecode mailing list