-------- Original Message --------
Subject:        [bugs #7532] [NSFileManager -fileExistsAtPath:isDirectory]
behaves differently from Apple's.
Date:   Sat, 31 Jan 2004 15:23:41 -0500
From:   Kazunobu Kuriyama <[EMAIL PROTECTED]>
To:     [EMAIL PROTECTED]



This mail is an automated notification from the bugs tracker
 of the project: GNUstep.




/**************************************************************************/
[bugs #7532] Full Item Snapshot:

URL: <http://savannah.gnu.org/bugs/?func=detailitem&item_id=7532>
Project: GNUstep
Submitted by: Kazunobu Kuriyama
On: Sat 01/31/04 at 20:23

Category:  Base/Foundation
Severity:  1 - None
Item Group:  Bug
Resolution:  None
Assigned to:  None
Status:  Open


Summary:  [NSFileManager -fileExistsAtPath:isDirectory] behaves differently from 
Apple's.

Original Submission:  In the specification, values returned through a pointer passed 
to isDirectory are not specified when a given path doesn't exist.  Nonetheless, the 
Apple's implementation returns the boolean NO if a given path doesn't exist.

Therefore, the following code works file for Mac,
but not for GNUstep:

NSFileManager *fm = [NSFileManager defaultManager];
NSString *path;
BOOL isDir;

(path is assumed to be set somewhere.)

[fm fileExistsAtPath: path isDirectory: &isDir];
if (isDir) {
    (some operations if path is a directory)
}

Actually, on my machine (i686-pc-linux-gnu), we got
isDir = 8 when 'path' is not an existing path, thereby it is regarded as a directory.

It is possible for us not to call it a GNUstep's bug because the behavior of the 
method of the Apple's version is not specified by the spec. Also, the code above 
itself is bad because it doesn't check the return value of the method.

Having said so, it would be reasonable to set 'isDir' to NO when 'path' is not an 
existing path.



CC List
-------

CC Address                          | Comment
------------------------------------+-----------------------------
kazu                                | 









For detailed info, follow this link:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=7532>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/








_______________________________________________
Bug-gnustep mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to