realbasic-nug
[Top] [All Lists]

FolderItem weirdness

To: RBNUG <realbasic-nug at lists dot realsoftware dot com>
Subject: FolderItem weirdness
From: "Dennis Birch" <dennisbirch at gmail dot com>
Date: Thu, 30 Mar 2006 08:41:15 -0800
Delivered-to: realbasic-nug at lists dot realsoftware dot com
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=Sgo9lpcEIhHLQkr23MvYgU0JqS6HYDx5QHO0I3I7NqTnheELZDMmMHoWz/wPwkEgpZyUt27VfJ5njx+r1sSfF5oEE6J9viMGHW1cfOcgrof/jV/1p4OQTH4vSS60Fk7u2v5oR04Hy52/GuRJOeGUFYwt0+NOD0ZotTx8lRM7d9s=
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>


<Prev in Thread] Current Thread [Next in Thread>