mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-20 12:16:40 +00:00
Ensure that NSBundle is initialised before changing current directory.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22522 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
be45c12fd5
commit
f6aad79d90
3 changed files with 19 additions and 1 deletions
|
@ -48,6 +48,7 @@
|
|||
#include "Foundation/NSProcessInfo.h"
|
||||
#include "Foundation/NSEnumerator.h"
|
||||
#include "Foundation/NSSet.h"
|
||||
#include "Foundation/NSBundle.h"
|
||||
#include "GSPrivate.h"
|
||||
|
||||
#include <string.h>
|
||||
|
@ -352,7 +353,19 @@ static NSStringEncoding defaultEncoding;
|
|||
*/
|
||||
- (BOOL) changeCurrentDirectoryPath: (NSString*)path
|
||||
{
|
||||
static Class bundleClass = 0;
|
||||
const _CHAR *lpath = [self fileSystemRepresentationWithPath: path];
|
||||
|
||||
/*
|
||||
* On some systems the only way NSBundle can determine the path to the
|
||||
* executable is by searching for it ... so it needs to know what was
|
||||
* the current directory at launch time ... so we must make sure it is
|
||||
* initialised before we change the current directory.
|
||||
*/
|
||||
if (bundleClass == 0)
|
||||
{
|
||||
bundleClass = [NSBundle class];
|
||||
}
|
||||
#if defined(__MINGW32__)
|
||||
return SetCurrentDirectoryW(lpath) == TRUE ? YES : NO;
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue