ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/prefs_editor_gtk.cpp
(Generate patch)

Comparing BasiliskII/src/Unix/prefs_editor_gtk.cpp (file contents):
Revision 1.36 by gbeauche, 2006-04-18T21:29:01Z vs.
Revision 1.37 by gbeauche, 2006-04-18T22:17:31Z

# Line 1678 | Line 1678 | static void sigchld_handler(int sig, sig
1678   {
1679          D(bug("Child %d exitted with status = %x\n", sip->si_pid, sip->si_status));
1680  
1681 <        int status = sip->si_status;
1681 >        // XXX perform a new wait because sip->si_status is sometimes not
1682 >        // the exit _value_ on MacOS X but rather the usual status field
1683 >        // from waitpid() -- we could arrange this code in some other way...
1684 >        int status;
1685 >        if (waitpid(sip->si_pid, &status, 0) < 0)
1686 >                status = sip->si_status;
1687 >        if (WIFEXITED(status))
1688 >                status = WEXITSTATUS(status);
1689          if (status & 0x80)
1690                  status |= -1 ^0xff;
1691  
# Line 1741 | Line 1748 | int main(int argc, char *argv[])
1748                  }
1749  
1750                  // Search and run the BasiliskII executable
1751 <                // XXX it can be in a bundle on MacOS X
1751 >                char *p;
1752                  strcpy(g_app_path, argv[0]);
1753 <                char *p = strrchr(g_app_path, '/');
1754 <                p = p ? p + 1 : g_app_path;
1755 <                *p = '\0';
1756 <                strcat(g_app_path, "BasiliskII");
1753 >                if ((p = strstr(g_app_path, "BasiliskIIGUI.app/Contents/MacOS")) != NULL) {
1754 >                    strcpy(p, "BasiliskII.app/Contents/MacOS/BasiliskII");
1755 >                        if (access(g_app_path, X_OK) < 0) {
1756 >                                char str[256];
1757 >                                sprintf(str, GetString(STR_NO_B2_EXE_FOUND), g_app_path, strerror(errno));
1758 >                                WarningAlert(str);
1759 >                                strcpy(g_app_path, "/Applications/BasiliskII.app/Contents/MacOS/BasiliskII");
1760 >                        }
1761 >                } else {
1762 >                        p = strrchr(g_app_path, '/');
1763 >                        p = p ? p + 1 : g_app_path;
1764 >                        strcpy(p, "BasiliskII");
1765 >                }
1766  
1767                  int pid = fork();
1768                  if (pid == 0) {
1769 +                        D(bug("Trying to execute %s\n", g_app_path));
1770                          execlp(g_app_path, g_app_path, "--gui-connection", gui_connection_path, (char *)NULL);
1771   #ifdef _POSIX_PRIORITY_SCHEDULING
1772                          // XXX get a chance to run the parent process so that to not confuse/upset GTK...

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines