Multiple Application Instances Opening same local db file

Ernesto Giannotta erne at apimac.com
Mon Feb 28 04:05:17 CST 2011


On 28-feb-2011, at 08:34, Ruslan Zasukhin wrote:

> On 2/28/11 2:56 AM, "Ernesto Giannotta" <erne at apimac.com> wrote:
> 
> Hi Erne,
> 
>> I was looking for a way to check if file is busy without try to open it, but
>> just couldn't find one.
> 
> Without check .vdb file  or any file?
> 

Well, right now I need it for .vdb file (I got custom extension though)
but would be nice to know the way for any file.

> What reason for such wish?
> 

ehm... with better testing I find I don't really need to know, just handle Vale exceptions.

BTW, trying to create a file that is already open with 

[DB create:[dbURL path]

throws an exception with properties:

Printing description of reason:
ErrorNumber:0xffffffd0

Printing description of name:
(null)

Printing description of userInfo:
(null)

Here's an example from Apple docs:

NSException* myException = [NSException
        exceptionWithName:@"FileNotFoundException"
        reason:@"File Not Found on System"
        userInfo:nil];

As you see we have a name property good for internal identification of the error, I guess a good place for the error number and a reason property good to be presented to the user (although no good enough for localized apps).




More information about the Valentina mailing list