Mercurial > pidgin.yaz
comparison pidgin/win32/winpidgin.c @ 23648:ab5b9acebde3
Update the Perl plugin loader to work with Perl 5.10.
I don't think this will break compiling with older versions (note that Perl
micro versions are not binary compatible).
Update the win32 build to use (and require and upgrade to Perl 5.10).
Fixes #5137
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Mon, 28 Jul 2008 00:52:54 +0000 |
parents | 6bd3a83e9d8c |
children | bd789c20f577 |
comparison
equal
deleted
inserted
replaced
23647:d48d333e6ef5 | 23648:ab5b9acebde3 |
---|---|
87 ret = TRUE; | 87 ret = TRUE; |
88 else { | 88 else { |
89 const char *err_msg = get_win32_error_message(retv); | 89 const char *err_msg = get_win32_error_message(retv); |
90 | 90 |
91 printf("Could not read reg key '%s' subkey '%s' value: '%s'.\nMessage: (%ld) %s\n", | 91 printf("Could not read reg key '%s' subkey '%s' value: '%s'.\nMessage: (%ld) %s\n", |
92 ((key == HKEY_LOCAL_MACHINE) ? "HKLM" : | 92 (key == HKEY_LOCAL_MACHINE) ? "HKLM" |
93 (key == HKEY_CURRENT_USER) ? "HKCU" : | 93 : ((key == HKEY_CURRENT_USER) ? "HKCU" : "???"), |
94 "???"), | |
95 sub_key, val_name, retv, err_msg); | 94 sub_key, val_name, retv, err_msg); |
96 } | 95 } |
97 RegCloseKey(hkey); | 96 RegCloseKey(hkey); |
98 } | 97 } |
99 else { | 98 else { |
214 } | 213 } |
215 | 214 |
216 | 215 |
217 /* Set up the settings dir base to be \\path\to | 216 /* Set up the settings dir base to be \\path\to |
218 * The actual settings dir will be \\path\to\.purple */ | 217 * The actual settings dir will be \\path\to\.purple */ |
219 snprintf(path2, sizeof(path2), "PURPLEHOME=%s", path); | 218 _snprintf(path2, sizeof(path2), "PURPLEHOME=%s", path); |
220 printf("Setting settings dir: %s\n", path2); | 219 printf("Setting settings dir: %s\n", path2); |
221 putenv(path2); | 220 _putenv(path2); |
222 | 221 |
223 snprintf(path2, sizeof(path2), "PIDGIN_ASPELL_DIR=%s\\Aspell\\bin", path); | 222 _snprintf(path2, sizeof(path2), "PIDGIN_ASPELL_DIR=%s\\Aspell\\bin", path); |
224 printf("%s\n", path2); | 223 printf("%s\n", path2); |
225 putenv(path2); | 224 _putenv(path2); |
226 | 225 |
227 /* set the GTK+ path to be \\path\to\GTK\bin */ | 226 /* set the GTK+ path to be \\path\to\GTK\bin */ |
228 strcat(path, "\\GTK\\bin"); | 227 strcat(path, "\\GTK\\bin"); |
229 | 228 |
230 common_dll_prep(path); | 229 common_dll_prep(path); |
435 const char *locale = NULL; | 434 const char *locale = NULL; |
436 char envstr[25]; | 435 char envstr[25]; |
437 | 436 |
438 locale = winpidgin_get_locale(); | 437 locale = winpidgin_get_locale(); |
439 | 438 |
440 snprintf(envstr, 25, "LANG=%s", locale); | 439 _snprintf(envstr, 25, "LANG=%s", locale); |
441 printf("Setting locale: %s\n", envstr); | 440 printf("Setting locale: %s\n", envstr); |
442 putenv(envstr); | 441 _putenv(envstr); |
442 } | |
443 | |
444 static void winpidgin_add_perl_to_path() { | |
445 char perl_path[MAX_PATH + 1]; | |
446 DWORD plen = sizeof(perl_path); | |
447 | |
448 printf("%s", "Looking for Perl... "); | |
449 | |
450 if (read_reg_string(HKEY_LOCAL_MACHINE, "SOFTWARE\\Perl", "", | |
451 (LPBYTE) &perl_path, &plen)) { | |
452 const char *path = getenv("PATH"); | |
453 /* Enough to add "PATH=" + ";" + perl_path + "\\bin" + \0 */ | |
454 | |
455 /* We *could* check for perl510.dll, but it seems unnecessary. */ | |
456 | |
457 printf("found in '%s'.\n", perl_path); | |
458 | |
459 if (perl_path[strlen(perl_path) - 1] != '\\') { | |
460 strcat(perl_path, "\\"); | |
461 } | |
462 strcat(perl_path, "bin"); | |
463 | |
464 if (!strstr(path, perl_path)) { | |
465 int newlen = (path ? strlen(path) : 0) + strlen(perl_path) + 10; | |
466 char *newpath = malloc(newlen); | |
467 *newpath = '\0'; | |
468 | |
469 _snprintf(newpath, newlen, "PATH=%s%s%s", | |
470 path ? path : "", | |
471 path ? ";" : "", | |
472 perl_path); | |
473 | |
474 printf("Adding Perl to PATH: %s\n", newpath); | |
475 | |
476 _putenv(newpath); | |
477 free(newpath); | |
478 } else | |
479 printf("%s\n", "Perl already in PATH."); | |
480 } else | |
481 printf("%s", "not found.\n"); | |
482 | |
443 } | 483 } |
444 | 484 |
445 #define PIDGIN_WM_FOCUS_REQUEST (WM_APP + 13) | 485 #define PIDGIN_WM_FOCUS_REQUEST (WM_APP + 13) |
446 #define PIDGIN_WM_PROTOCOL_HANDLE (WM_APP + 14) | 486 #define PIDGIN_WM_PROTOCOL_HANDLE (WM_APP + 14) |
447 | 487 |
596 prev[0] = '\0'; | 636 prev[0] = '\0'; |
597 } | 637 } |
598 } else { | 638 } else { |
599 DWORD dw = GetLastError(); | 639 DWORD dw = GetLastError(); |
600 const char *err_msg = get_win32_error_message(dw); | 640 const char *err_msg = get_win32_error_message(dw); |
601 snprintf(errbuf, 512, | 641 _snprintf(errbuf, 512, |
602 "Error getting module filename.\nError: (%u) %s", | 642 "Error getting module filename.\nError: (%u) %s", |
603 (UINT) dw, err_msg); | 643 (UINT) dw, err_msg); |
604 printf("%s", errbuf); | 644 printf("%s\n", errbuf); |
605 MessageBox(NULL, errbuf, NULL, MB_OK | MB_TOPMOST); | 645 MessageBox(NULL, errbuf, NULL, MB_OK | MB_TOPMOST); |
606 pidgin_dir[0] = '\0'; | 646 pidgin_dir[0] = '\0'; |
607 } | 647 } |
608 | 648 |
609 /* Determine if we're running in portable mode */ | 649 /* Determine if we're running in portable mode */ |
629 portable_mode_dll_prep(pidgin_dir); | 669 portable_mode_dll_prep(pidgin_dir); |
630 else if (!getenv("PIDGIN_NO_DLL_CHECK")) | 670 else if (!getenv("PIDGIN_NO_DLL_CHECK")) |
631 dll_prep(); | 671 dll_prep(); |
632 | 672 |
633 winpidgin_set_locale(); | 673 winpidgin_set_locale(); |
674 | |
675 winpidgin_add_perl_to_path(); | |
676 | |
634 /* If help, version or multiple flag used, do not check Mutex */ | 677 /* If help, version or multiple flag used, do not check Mutex */ |
635 if (!strstr(lpszCmdLine, "-h") && !strstr(lpszCmdLine, "-v")) | 678 if (!strstr(lpszCmdLine, "-h") && !strstr(lpszCmdLine, "-v")) |
636 if (!winpidgin_set_running(getenv("PIDGIN_MULTI_INST") == NULL && strstr(lpszCmdLine, "-m") == NULL)) | 679 if (!winpidgin_set_running(getenv("PIDGIN_MULTI_INST") == NULL && strstr(lpszCmdLine, "-m") == NULL)) |
637 return 0; | 680 return 0; |
638 | 681 |
643 if (!pidgin_main) { | 686 if (!pidgin_main) { |
644 DWORD dw = GetLastError(); | 687 DWORD dw = GetLastError(); |
645 BOOL mod_not_found = (dw == ERROR_MOD_NOT_FOUND || dw == ERROR_DLL_NOT_FOUND); | 688 BOOL mod_not_found = (dw == ERROR_MOD_NOT_FOUND || dw == ERROR_DLL_NOT_FOUND); |
646 const char *err_msg = get_win32_error_message(dw); | 689 const char *err_msg = get_win32_error_message(dw); |
647 | 690 |
648 snprintf(errbuf, 512, "Error loading pidgin.dll.\nError: (%u) %s%s%s", | 691 _snprintf(errbuf, 512, "Error loading pidgin.dll.\nError: (%u) %s%s%s", |
649 (UINT) dw, err_msg, | 692 (UINT) dw, err_msg, |
650 mod_not_found ? "\n" : "", | 693 mod_not_found ? "\n" : "", |
651 mod_not_found ? "This probably means that GTK+ can't be found." : ""); | 694 mod_not_found ? "This probably means that GTK+ can't be found." : ""); |
652 printf("%s", errbuf); | 695 printf("%s\n", errbuf); |
653 MessageBox(NULL, errbuf, TEXT("Error"), MB_OK | MB_TOPMOST); | 696 MessageBox(NULL, errbuf, TEXT("Error"), MB_OK | MB_TOPMOST); |
654 | 697 |
655 return 0; | 698 return 0; |
656 } | 699 } |
657 | 700 |