[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSUser.m: NSTemporaryDirectory()
From: |
Pascal J. Bourguignon |
Subject: |
Re: NSUser.m: NSTemporaryDirectory() |
Date: |
Wed, 4 Apr 2001 19:58:04 +0200 (CEST) |
> GNUstep's NSTemporaryDirectory() returns the temporary directory plus
> the user's name appended to it. In Apple's Foundation reference its
> behaviour is defined as follows:
>
> -----------
>
> NSTemporaryDirectory
>
> This function returns the temporary directory on the user's system.
> NSString *NSTemporaryDirectory(void)
>
> Returns a string containing the path of the current temporary directory.
> If no such directory is currently available, this function returns nil.
>
> See also NSStandardApplicationPaths, NSStandardLibraryPaths,
> NSHomeDirectory
>
> ----------
>
>
> GNUstep's NSTemporaryDirectory() never returns nil.
>
> Are we trying to implement NeXT's behaviour or should we change
> (improve?) these things?
>
> Michael
If you translate the specification of MacOSX, you'll get:
/*
PRE: TRUE
*/
tmpdir=NSTemporaryDirectory();
/* POST: ( tmpdir!=nil and tmpdir is a path-name,
and for some time after, tmpdir is
the path-name of a directory)
) or tmpdir==nil.
*/
Note that since at any time the temporary directory may be deleted and
then a file created with the same name by any other process, to all
effects, the post-condition is:
(tmpdir!=nil and tmpdir is a path-name) or tmpdir==nil.
That is, NSTemporaryDirectory can return nil or a path name, and if it
return a path-name, no much can be said of it (the joys of parallel
programming!).
Since there is no other mean to determine if "there exists a temporary
directory on the user's system", and implementation that would return
always a path-name would match the post-condition. (You can always add
false disjonctions to the post condition...).
Alternatively, an implementation that would always return nil would be
as well valid.
--
__Pascal_Bourguignon__ (o_ Software patents are endangering
() ASCII ribbon against html email //\ the computer industry all around
/\ and Microsoft attachments. V_/ the world http://lpf.ai.mit.edu/
1962:DO20I=1.100 2001:my($f)=`fortune`; http://petition.eurolinux.org/