From 2ea4cc8729b18bffbc4e5ae12982f10cad48366d Mon Sep 17 00:00:00 2001 From: "alecf%netscape.com" Date: Thu, 25 Mar 1999 22:45:46 +0000 Subject: [PATCH] fix for #4264 - move fe_GetConfigDir into libxp, because that is in-memory and available for components to use I've heard rumors that this will break mac, but I'll be able to fix it in one cycle This allows components that don't link against libpref to be loaded and not crash --- lib/xp/xp_file.c | 25 +++++++++++++++++++++++++ modules/libpref/src/unix/unixpref.c | 22 ---------------------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/lib/xp/xp_file.c b/lib/xp/xp_file.c index 56ac549acf19..8e85de3fdb77 100644 --- a/lib/xp/xp_file.c +++ b/lib/xp/xp_file.c @@ -1707,4 +1707,29 @@ WH_TempName(XP_FileType type, const char * prefix) #endif /* !XP_WIN && !XP_OS2 */ +#ifndef MOZ_USER_DIR +#define MOZ_USER_DIR ".mozilla" +#endif + +char *fe_GetConfigDir(void) { + char *home = getenv("HOME"); + if (home) { + char *config_dir; + + int len = strlen(home); + len += strlen("/") + strlen(MOZ_USER_DIR) + 1; + + config_dir = (char *)XP_CALLOC(len, sizeof(char)); + /* we really should use XP_STRN*_SAFE but this is MODULAR_NETLIB */ + XP_STRCPY(config_dir, home); + XP_STRCAT(config_dir, "/"); + XP_STRCAT(config_dir, MOZ_USER_DIR); + return config_dir; + } + + return strdup("/tmp"); +} + + + /******************************************************************************/ diff --git a/modules/libpref/src/unix/unixpref.c b/modules/libpref/src/unix/unixpref.c index de821c71d94a..fd0bbee852db 100644 --- a/modules/libpref/src/unix/unixpref.c +++ b/modules/libpref/src/unix/unixpref.c @@ -114,25 +114,3 @@ char *fe_GetConfigDirFilename(char *filename) } -#ifndef MOZ_USER_DIR -#define MOZ_USER_DIR ".mozilla" -#endif - -char *fe_GetConfigDir(void) { - char *home = getenv("HOME"); - if (home) { - char *config_dir; - - int len = strlen(home); - len += strlen("/") + strlen(MOZ_USER_DIR) + 1; - - config_dir = (char *)XP_CALLOC(len, sizeof(char)); - /* we really should use XP_STRN*_SAFE but this is MODULAR_NETLIB */ - XP_STRCPY(config_dir, home); - XP_STRCAT(config_dir, "/"); - XP_STRCAT(config_dir, MOZ_USER_DIR); - return config_dir; - } - - return strdup("/tmp"); -}