More revCopyFolder issues

Peter Haworth pete at lcsql.com
Sat May 12 14:23:35 EDT 2012


Now I'm looking in the right place for my files, I'm running into a couple
of strange behaviors of revCopyFolder that I'd like to share.  This all
with OS X 10.6.8/LC 5.0.

By way of background, I am dealing with getting my SQLiteAdmin app ready
for the Apple Store, part of which entails changing the location of its
prefs file (apparently, ~/Library/Preferences is not an appropriate folder
for Preferences files?) and I'm writing startup code that takes care of
moving it (and a couple of other files) so existing users don't lose their
Prefs.  My prefs file is stored as a single string created with
arrayEncode().

It appears that if there is a folder in the revCopyFolder destination with
the same name as the source folder, revCopyFolder does not do the copy but
still returns OK in it.  It seems like It should either overwrite the
folder (perhaps with a confirming prompt) or return an error of some sort
in it.

Once I figured that out, I ran into a problem accessing the copied Prefs
file. The code I've been using for months to read it is:

open file tPath for read
read from file tPath until EOF
put arrayDecode(it) into tPrefs

When I use that code to access the copied prefs file, I get a run time
error on the arrayDecode line "arrayDecode: failure".  I've seen that in
the past when the string to be decoded is not in arrayEncode format.

Clutching at straws, I changed the first line of the code to "open file
tPath for binary read" and all works fine again.  I'm OK with that but
clearly revCopyFolder changed some characteristic of the file that made it
necessary to access it as a binary file. The new or original code still
works on the old Prefs file.

Neither of these issues is a big deal once you know about them, but seems
like it would be good if the dictionary was more forthcoming about stuff
like that.  I should probably add a comment to the revCopyFolder entry.

Pete
lcSQL Software <http://www.lcsql.com>



More information about the use-livecode mailing list