On Jul 29, 2005, at 10:09 PM, Kevin Bracey wrote:
We all know users like to move, and delete there own files. I'm
storing GetSaveInfo of the last opened file and would like to open it
when my app re-opens, so they can continue working on the last
document. I also want to maintain an Open Recent file menu. There
seems to be so many things to check, before reading a file. What is
the best method?
myFolderItem = GetFolderItem( savedGetSaveInfo )
If myFolderItem <> Nil Then
If myFolderItem.Exists Then
If myFolderItem.IsReadable Then
If myFolderItem.Length <> 0 then
If myFolderItem.LastErrorCode <> 101 AND
myFolderItem.LastErrorCode <> 102 Then // File Not Found or Access
Denied
holdImReadable = True
End
End
End
End
End
It's not clear to me precisely what you want to check. For building
the recent items menu, it is enough to check that the alias returns a
non-nil, existing FolderItem. You can worry about readability only
when the user attempts to read the file, at which point you can simply
attempt to get a BinaryStream or TextInputStream. If you can, then the
file is probably readable.
I wrote an article for RBD on building a recent items menu for issue
2.1. You might consider purchasing that issue from the RBD web site
<http://www.rbdeveloper.com/>.
--------------
Charles Yeomans
_______________________________________________
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>
|