* Fix restart-helper to work with spaces in the bundle name.

* Add some helpful debug printfs.

closes #1103.

Originally committed to SVN as r3992.
This commit is contained in:
Amar Takhar 2010-01-18 06:49:49 +00:00
parent 998c42c4a1
commit cfe1faa6ad
2 changed files with 15 additions and 5 deletions

View File

@ -52,7 +52,7 @@ int main(int argc, char *argv[], char *env[])
if ((queue = kqueue()) == -1)
{
perror("kqueue()");
perror("Error in: kqueue()");
return 1;
}
@ -63,26 +63,34 @@ int main(int argc, char *argv[], char *env[])
NOTE_EXIT,
0, 0);
printf("restart-helper: waiting for pid %d\n", waitpid);
nchange = kevent(queue, change, 1, event, 1, &timeout);
if (nchange < 0)
{
perror("kevent()");
perror("restart-helper: Error in kevent()");
return 2;
}
else if (nchange == 0)
{
printf("restart-helper: Timed out waiting for pid %d\n", waitpid);
return 3;
}
else if (change[0].flags & EV_ERROR)
{
perror("restart-helper: Error in event");
return 2;
}
else
{
close(queue);
printf("restart-helper: Executing '%s'\n", argv[1]);
if (execve(argv[1], argv+1, env) == -1)
{
perror("execve()");
perror("restart-helper: Error in execve()");
return 4;
}
return 0; /* never reached */

View File

@ -426,8 +426,10 @@ void RestartAegisub() {
char *bundle_path = OSX_GetBundlePath();
char *support_path = OSX_GetBundleSupportFilesDirectory();
if (!bundle_path || !support_path) return; // oops
wxExecute(wxString::Format(_T("%s/MacOS/restart-helper /usr/bin/open \"%s\""), wxString(support_path, wxConvUTF8).c_str(), wxString(bundle_path, wxConvUTF8).c_str()));
free(bundle_path);
wxString exec = wxString::Format(_T("\"%s/MacOS/restart-helper\" /usr/bin/open -n \"%s\"'"), wxString(support_path, wxConvUTF8).c_str(), wxString(bundle_path, wxConvUTF8).c_str());
wxLogDebug("RestartAegisub: (%s)", exec);
wxExecute(exec);
free(bundle_path);
free(support_path);
#else
wxStandardPaths stand;