Skip to content

Commit

Permalink
Set launch directory before AbsolutePathOfExecutable() needs it.
Browse files Browse the repository at this point in the history
  • Loading branch information
rfm committed Dec 8, 2024
1 parent 597d10d commit 4a4a802
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Source/NSBundle.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,18 @@

#import "GSPrivate.h"

/* Store the working directory at startup */
static NSString *_launchDirectory = nil;

static NSFileManager *
manager()
{
static NSFileManager *mgr = nil;

if (mgr == nil)
if (nil == mgr)
{
mgr = RETAIN([NSFileManager defaultManager]);
ASSIGN(_launchDirectory, [mgr currentDirectoryPath]);
[[NSObject leakAt: &mgr] release];
}
return mgr;
Expand Down Expand Up @@ -186,9 +190,6 @@ + (NSString**) frameworkClasses;
static NSMapTable *_byClass = NULL;
static NSMapTable *_byIdentifier = NULL;

/* Store the working directory at startup */
static NSString *_launchDirectory = nil;

static NSString *_base_version
= OBJC_STRINGIFY(GNUSTEP_BASE_MAJOR_VERSION.GNUSTEP_BASE_MINOR_VERSION);

Expand Down Expand Up @@ -1719,8 +1720,6 @@ + (void) initialize
if ((str = [env objectForKey: @"LIBRARY_COMBO"]) != nil)
library_combo = RETAIN(str);

_launchDirectory = RETAIN([manager() currentDirectoryPath]);

_gnustep_bundle = RETAIN([self bundleForLibrary: @"gnustep-base"
version: _base_version]);

Expand Down

0 comments on commit 4a4a802

Please sign in to comment.