I've run into a situation that has required me to write a somewhat kludgey
workaround, and I'm wondering if anybody has any better suggestions. This
issue is occurring in RB 5.5.5 in Mac OS X 10.4.5.

I have a routine that opens my application's data files. Because I have gone
to a new version of the application with a slightly different file format, I
want to first save a backup of the old file in cases where people are
working with files created/saved in previous versions. So I go through
something like the following:

Function OpenDataFile(realFile As FolderItem, backedUp As Boolean = False)

if version < kCurrentVersion and not backedUp Then
  realFile.CopyFileTo backupFileName
  return OpenDataFile(realFile, True)
else
  OpenTheFile
  Return true
end if

End Function

The problem is that when this routine calls itself the second time, it fails
during one of the several checks I left out of this pseudo-code and returns
false. I noticed that it doesn't happen if I step through the same code in
the debugger. So I added a While...Wend loop to delay calling the line "n
OpenDataFile(realFile, True)", but that didn't help either. Finally I came
up with the workaround of instantiating a timer that adds a brief delay, and
that did succeed. But it really seems like a hack. I don't understand what's
going on, or how I could better code around this. Any ideas?
_______________________________________________
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>

Reply via email to