Beta two was just combining Backup Folder and Delete
Sync. This was mostly
copy and paste, though I did some variable renaming to make it look a
bit
better. Beta three was just a bunch of bug fixes. After Beta three
there was
one major outstanding issue which has mostly been fixed with Beta four.
But
that may have left Beta four unstable so Beta five will likely be more
bug
fixes.
One thing I couldn't do with the log output to file was append \r\n to
the
end of each line. Script Editor didn't like \n, so I'm left with
leaving it
in Mac format. Also, annoyingly Script Editor still insists of
converting \r
into actual line endings, which makes the program listing a bit messy.
Note
that when I first write to the file I take care to start at the end of
the
file, so I won't overwrite it. Unfortunately, the choose file
will
give a "this file will be replaced" warning if you choose an existing
file.
The big issue after Beta 3 was that I couldn't copy applications.
Actually,
I could copy some applications but not others. It took me a couple of
hours
of thinking and testing to realize that it had problems with
Application
Frameworks. These are the application folders recently introduced,
where the
application is actually a regular folder structure tagged as an
application.
To make it easier for users, the Finder automatically displays
Application
Frameworks as a file rather than a folder.
That's fine and dandy, but the crux of my problem was that Application
Frameworks frequently end with ".app", which the Finder hides. Hides
even
from AppleScript. Meaning that, when I get a list of folder contents,
the
applications have ".app" stripped. Then when I try to get the
application
file I get an error because it doesn't exist. Fine, I can add ".app" to
the
application name and then get it fine. But if I try to get any
information
from the application object I get an error because AppleScript doesn't
use
".app".
-- Cycle through items in the current folder and process each item set l_items to list folder of l_current_folder repeat with l_source_item_name in l_items set l_source_invalid to false try set l_source_item to (item (l_source_item_name as string) of l_current_folder) as file specification set l_source_info to my addIsFolderAttribute(info for l_source_item) set l_copy_item to false set l_dest_item to "" set l_dest_info to "" set l_source_app to false on error l_error set l_source_invalid to true log "*****Error processing source item " & l_current_folder & l_source_item_name log "*****" & l_error if (class of m_log_file is file specification) then write "*****Error processing source item " & l_current_folder & l_source_item_name & " " to m_log_file write "*****" & l_error & " " to m_log_file end if end try
As the above code shows, the solution is to not use the Finder. The
Standard
Additions Dictionary contains some Finder-like commands that don't use
Finder
objects. list folder {file specification} merely returns the
text
names of the folder contents, rather than the items themselves. The
names are
the actual names, including ".app" for Application Frameworks. As a
bonus,
you also get invisible items too.
|