Mercurial > pidgin
changeset 18786:60b405e0b28e
Fix "pidgin.exe --portable-mode" not to pass the flag to pidgin's init, so getopt doesn't choke on it. Fixes #2392.
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Thu, 02 Aug 2007 20:14:31 +0000 |
parents | 3cc77409b858 |
children | 09103d3ba774 |
files | pidgin/win32/winpidgin.c |
diffstat | 1 files changed, 16 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/win32/winpidgin.c Thu Aug 02 19:52:00 2007 +0000 +++ b/pidgin/win32/winpidgin.c Thu Aug 02 20:14:31 2007 +0000 @@ -332,10 +332,10 @@ break; case LANG_ROMANIAN: posix = "ro"; break; case LANG_RUSSIAN: posix = "ru"; break; - /* LANG_CROATIAN == LANG_SERBIAN == LANG_BOSNIAN */ case LANG_SLOVAK: posix = "sk"; break; case LANG_SLOVENIAN: posix = "sl"; break; case LANG_ALBANIAN: posix = "sq"; break; + /* LANG_CROATIAN == LANG_SERBIAN == LANG_BOSNIAN */ case LANG_SERBIAN: switch (sub_id) { case SUBLANG_SERBIAN_LATIN: @@ -538,6 +538,8 @@ char exe_name[MAX_PATH]; HMODULE hmod; char *tmp; + int pidgin_argc = __argc; + char **pidgin_argv = __argv; /* If debug or help or version flag used, create console for output */ if (strstr(lpszCmdLine, "-d") || strstr(lpszCmdLine, "-h") || strstr(lpszCmdLine, "-v")) { @@ -601,8 +603,20 @@ /* Determine if we're running in portable mode */ if (strstr(lpszCmdLine, "--portable-mode") || (exe_name != NULL && strstr(exe_name, "-portable.exe"))) { + int i = 0, c = 0; + printf("Running in PORTABLE mode.\n"); portable_mode = TRUE; + + /* Remove the --portable-mode arg from the args passed to pidgin so it doesn't choke */ + pidgin_argv = malloc(sizeof(char*) * pidgin_argc); + for (; i < __argc; i++) { + if (strstr(__argv[i], "--portable-mode") == NULL) { + pidgin_argv[c] = __argv[i]; + c++; + } else + pidgin_argc--; + } } if (portable_mode) @@ -635,5 +649,5 @@ return 0; } - return pidgin_main(hInstance, __argc, __argv); + return pidgin_main(hInstance, pidgin_argc, pidgin_argv); }