bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fwd: [bugs #7532] [NSFileManager -fileExistsAtPath:isDirectory] behaves


From: Kazunobu Kuriyama
Subject: [Fwd: [bugs #7532] [NSFileManager -fileExistsAtPath:isDirectory] behaves differently from Apple's.]
Date: Sun, 01 Feb 2004 05:30:19 +0900
User-agent: Mozilla/5.0 (X11; U; Linux i686; ja-JP; rv:1.4) Gecko/20030624 Netscape/7.1


-------- 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 <address@hidden>
To:     address@hidden



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/










reply via email to

[Prev in Thread] Current Thread [Next in Thread]