[ATTENTION], "problem" with FolderItem.Exists
Kevin Windham
kevo at gatorgraphics.com
Mon Feb 21 09:34:19 CST 2005
On Feb 21, 2005, at 9:03 AM, jda wrote:
>
> Kevin, do you use RB? I ask because if you do you should know that
> GetSaveFolderItem (see above) is a standard method for obtaining a
> folderItem prior to saving a file to disk:
>
> f = GetSaveFolderItem("", "database1")
>
> It puts up a standard "Save As" dialog box.
>
> If you click Save and the file already exists, you are asked if you
> want to replace it with a new file. You can cancel or proceed. If you
> proceed, a folderItem is created. Valentina hasn't yet entered the
> picture.
Does the bug only occur with a folderitem created from
GetSaveFolderitem? How does valentina know that? I am looking at this
from an API perspective. Not from the user perspective. What if the
developer passed in a folderitem that existed and didn't use the
GetSaveFolderitem. Wouldn't the bug still happen? Now the user has lost
a file that they didn't agree to losing.
Like I said, this is just my opinion, but a command called create
should create something, not destroy something. I personally would not
intentionally choose to allow a create command that I put in one of my
own programs to destroy something. It's unexpected and
counter-intuitive.
That's all I'm getting at. It's a separation of powers kind of thing.
> You pass this folderItem to Valentina in db.create(f...). Valentina
> overwrites the existing file. This triggers the bug.
I'm still not sure this is a "bug" in the sense that RB is doing
something wrong. A plugin changed a file reference out from under it. I
think there is a folderitem API in the plugin SDK and if it's not used
to update the folderitem in Ruslan's code, then I don't think it's an
RB problem. I don't know what Ruslan is doing in his code, and if it
were up to me I wouldn't necessarily change anything except returning
false if the folderitem you want "created" already exists.
Just my 2¢, feel free to ignore if you like. It seems that happens a
lot these days. :-)
Kevin
More information about the Valentina-beta
mailing list