diff --git a/Source/NSString.m b/Source/NSString.m index 032a18a1a..7c2c3c1db 100644 --- a/Source/NSString.m +++ b/Source/NSString.m @@ -2361,7 +2361,14 @@ handle_printf_atsign (FILE *stream, /* Return a string for passing to OS calls to handle file system objects. */ - (const char*) fileSystemRepresentation { - return [[NSFileManager defaultManager] fileSystemRepresentationWithPath: self]; + static NSFileManager *fm = nil; + + if (fm == nil) + { + fm = [NSFileManager defaultManager]; + } + + return [fm fileSystemRepresentationWithPath: self]; } - (BOOL) getFileSystemRepresentation: (char*)buffer maxLength: (unsigned)size