From 2ee10362f11fb8dd0cf2c3e2ef6e26b7b23bca10 Mon Sep 17 00:00:00 2001 From: nico Date: Sat, 21 Apr 2001 18:12:06 +0000 Subject: [PATCH] Cache the file manager when getting the file system representation git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@9652 72102866-910b-0410-8b05-ffd578937521 --- Source/NSString.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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