Hi, Joe--
I'm now having (what appears to be) one last problem before this thing is
done.
Basically, I was getting a nilobject in a strange place. I had copied the
code for the method I used directly from the LR, CopyFileOrFolder. Here's
the code (this is the second to last example from the FolderItem Class
subject) :
Sub CopyFileorFolder (source as FolderItem, destination as FolderItem)
Dim i as Integer
Dim newFolder as FolderItem
If source.directory then //it's a folder
newFolder=destination.child(source.name)
newFolder.createAsFolder
For i=1 to source.count //go through each item
If source.item(i).directory then
//it's a folder
CopyFileOrFolder source.item(i), newFolder
//recursively call this
//routine passing it the folder
else
source.item(i).CopyFileTo newFolder
//it's a file so copy it
end if
next
else //it's not a folder
source.CopyFileTo destination
end if
End Sub
The nilobject is occurring here:
For i=1 to source.count
But when all the values are viewed in the debugger, nothing seems amiss.
However, as the lr suggests, I added an exception trap at the end:
exception err as NilObjectException
msgbox "Some NilObject occurred."
The very next step hits this line, with the nilobject being "destination".
I posted this to the RB Forum, and received this revision as a solution:
If source.directory then //it's a folder
if not destination.exists then// create the destination folder if it
does not exist
destination.createAsFolder
end
newFolder=destination.child(source.name)
newFolder.createAsFolder
This indeed stops the nilobject. But it has the unintended side-effect of
creating a duplicate folder for each one found. So instead of Original
Folder-->It's Contents, the new directory structure for the copy is Original
Folder-->Original Folder-->It's Contents.
This is especially bad for bundles, as they appear normally, but no longer
open, as the real bundle is actually inside the new folder's contents, and
so can't be accessed by just double-clicking.
Also, it seems to me that destination, being the target to where the
original file is supposed to be copied, would naturally not exist prior to
the copy process. So I don't understand why the nilobject would occur in the
first place. Isn't that exactly what this routine is supposed to be handling
-- the creation of either non-existent folders or files to a specified
location copied from a source location?
This really is a bit beyond my (very limited) abilities. Can you suggest
what may be going on here?
I've uploaded the project file to my server:
http://dhnet.us/compare/Compare_Volumes.rb.sit
Thank you again :)
All My Best,
Jeffrey
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>