Hi...
While migrating sources I found that fileSystemRepresentationWithPath:
can not
correctly handle arguments equal to nil so it will crash on win. (I am
using base-1.5.0)
This method is quite frequently used in NSFileManager on many locations.
- (const char*) fileSystemRepresentationWithPath: (NSString*)path
{
#ifdef __MINGW__
/*
* If path is in Unix format, transmogrify it so Windows functions
* can handle it
*/ NSString *newpath;
const char *c_path;
int l;
path = [path stringByStandardizingPath];
newpath = path;
c_path = [path cString];
l = strlen(c_path);
if (c_path == 0)
{
return 0;
}
...
If you supply nil for path it will crash in strlen() which is quite
ugly.
I suggest to move
l = strlen(c_path);
after the following if (c_path == 0) statement. So the method will
correctly exit in this case.
(and bringing back OS4.2 behaviour).
What do you think? Is this change acceptable?