From c7a9abfa6a1e93f4e207e5565ca290a2e107081b Mon Sep 17 00:00:00 2001 From: "pinkerton%netscape.com" Date: Mon, 3 Jun 2002 14:38:32 +0000 Subject: [PATCH] correctly launch if any non-ascii chars are in the path. bug 148432 --- camino/CHPreferenceManager.mm | 8 ++------ camino/src/preferences/PreferenceManager.mm | 8 ++------ chimera/CHPreferenceManager.mm | 8 ++------ chimera/src/preferences/PreferenceManager.mm | 8 ++------ 4 files changed, 8 insertions(+), 24 deletions(-) diff --git a/camino/CHPreferenceManager.mm b/camino/CHPreferenceManager.mm index a094aef560e..54d4e8be49b 100644 --- a/camino/CHPreferenceManager.mm +++ b/camino/CHPreferenceManager.mm @@ -54,12 +54,8 @@ extern const char *prefContractID; - (BOOL) initMozillaPrefs { - NSBundle *mainBundle = [NSBundle mainBundle]; - NSString *path = [mainBundle bundlePath]; - NSMutableString *mutablePath = [NSMutableString stringWithString:path]; - [mutablePath appendString:@"/Contents/MacOS/"]; - const char *cstr = [mutablePath cString]; - setenv("MOZILLA_FIVE_HOME", cstr, 1); + NSString *path = [[[NSBundle mainBundle] executablePath] stringByDeletingLastPathComponent]; + setenv("MOZILLA_FIVE_HOME", [path fileSystemRepresentation], 1); nsresult rv; rv = NS_InitEmbedding(nsnull, nsnull); diff --git a/camino/src/preferences/PreferenceManager.mm b/camino/src/preferences/PreferenceManager.mm index a094aef560e..54d4e8be49b 100644 --- a/camino/src/preferences/PreferenceManager.mm +++ b/camino/src/preferences/PreferenceManager.mm @@ -54,12 +54,8 @@ extern const char *prefContractID; - (BOOL) initMozillaPrefs { - NSBundle *mainBundle = [NSBundle mainBundle]; - NSString *path = [mainBundle bundlePath]; - NSMutableString *mutablePath = [NSMutableString stringWithString:path]; - [mutablePath appendString:@"/Contents/MacOS/"]; - const char *cstr = [mutablePath cString]; - setenv("MOZILLA_FIVE_HOME", cstr, 1); + NSString *path = [[[NSBundle mainBundle] executablePath] stringByDeletingLastPathComponent]; + setenv("MOZILLA_FIVE_HOME", [path fileSystemRepresentation], 1); nsresult rv; rv = NS_InitEmbedding(nsnull, nsnull); diff --git a/chimera/CHPreferenceManager.mm b/chimera/CHPreferenceManager.mm index a094aef560e..54d4e8be49b 100644 --- a/chimera/CHPreferenceManager.mm +++ b/chimera/CHPreferenceManager.mm @@ -54,12 +54,8 @@ extern const char *prefContractID; - (BOOL) initMozillaPrefs { - NSBundle *mainBundle = [NSBundle mainBundle]; - NSString *path = [mainBundle bundlePath]; - NSMutableString *mutablePath = [NSMutableString stringWithString:path]; - [mutablePath appendString:@"/Contents/MacOS/"]; - const char *cstr = [mutablePath cString]; - setenv("MOZILLA_FIVE_HOME", cstr, 1); + NSString *path = [[[NSBundle mainBundle] executablePath] stringByDeletingLastPathComponent]; + setenv("MOZILLA_FIVE_HOME", [path fileSystemRepresentation], 1); nsresult rv; rv = NS_InitEmbedding(nsnull, nsnull); diff --git a/chimera/src/preferences/PreferenceManager.mm b/chimera/src/preferences/PreferenceManager.mm index a094aef560e..54d4e8be49b 100644 --- a/chimera/src/preferences/PreferenceManager.mm +++ b/chimera/src/preferences/PreferenceManager.mm @@ -54,12 +54,8 @@ extern const char *prefContractID; - (BOOL) initMozillaPrefs { - NSBundle *mainBundle = [NSBundle mainBundle]; - NSString *path = [mainBundle bundlePath]; - NSMutableString *mutablePath = [NSMutableString stringWithString:path]; - [mutablePath appendString:@"/Contents/MacOS/"]; - const char *cstr = [mutablePath cString]; - setenv("MOZILLA_FIVE_HOME", cstr, 1); + NSString *path = [[[NSBundle mainBundle] executablePath] stringByDeletingLastPathComponent]; + setenv("MOZILLA_FIVE_HOME", [path fileSystemRepresentation], 1); nsresult rv; rv = NS_InitEmbedding(nsnull, nsnull);