diff --git a/api/graphics2_unix.C b/api/graphics2_unix.C index fc489e8d46..813785e893 100644 --- a/api/graphics2_unix.C +++ b/api/graphics2_unix.C @@ -154,8 +154,8 @@ void boinc_graphics_loop(int argc, char** argv) { #endif boinc_glut_init(); make_window(); - glutTimerFunc(TIMER_INTERVAL_MSEC, timer_handler, 0); #ifdef __APPLE__ + glutTimerFunc(TIMER_INTERVAL_MSEC, timer_handler, 0); // Apparently glut changed our working directory in OS 10.3.9 chdir(dir); #endif diff --git a/api/mac_icon.C b/api/mac_icon.C index 32c4c89883..8bef42d14c 100644 --- a/api/mac_icon.C +++ b/api/mac_icon.C @@ -32,7 +32,11 @@ */ #include +#include // for MAXPATHLEN +#include + #include "boinc_api.h" +#include "common_defs.h" #define RESIDICON -16455 @@ -49,7 +53,7 @@ char MacPListData[] = "\n" fprintf(stderr,"MacOS Error %d occured in %s line %d\n",e,__FILE__,__LINE__);\ return(e); } } -// Adds ther specified resource to the file given as an argument. +// Adds the specified resource to the file given as an argument. int setMacRsrcForFile(char *filename, char *rsrcData, long rsrcSize, OSType rsrcType, int rsrcID, StringPtr rsrcName) { OSErr oserr; /* stores an OS error code */ @@ -81,8 +85,9 @@ int setMacRsrcForFile(char *filename, char *rsrcData, long rsrcSize, oserr = ResError(); } } - if (oserr == noErr) - break; + // We may not have permissions to set resources in debug runs + if ((oserr == noErr) || (oserr == wrPermErr) || (oserr == permErr)) + break; sleep (1); }; @@ -131,10 +136,17 @@ static char * PersistentFGets(char *buf, size_t buflen, FILE *f) { void getPathToThisApp(char* pathBuf, size_t bufSize) { FILE *f; - char buf[64], *c; + char buf[MAXPATHLEN], *c; pid_t myPID = getpid(); int i; + struct stat stat_buf; + strcpy(pathBuf, GRAPHICS_APP_FILENAME); + if (!stat(pathBuf, &stat_buf)) { + // stat() returns zero on success + return; + } + *pathBuf = 0; // in case of failure // Before launching this project application, the BOINC client set the @@ -142,7 +154,7 @@ void getPathToThisApp(char* pathBuf, size_t bufSize) { // (or the soft-link to it.) So all we need for the path to this // application is the file name. We use the -c option so ps strips off // any command-line arguments for us. - sprintf(buf, "ps -cp %d -o command=", myPID); + sprintf(buf, "ps -wcp %d -o command=", myPID); f = popen(buf, "r"); if (!f) return; @@ -164,11 +176,11 @@ void getPathToThisApp(char* pathBuf, size_t bufSize) { // Adds plst resource 0 to the file given as an argument. This -// identifies the applciation to the OS as an NSUIElement, so +// identifies the application to the OS as an NSUIElement, so // that the application does not show in the Dock and it has no // menu bar. int setMacPList() { - char path[1024], resolvedPath[1024];; + char path[1024], resolvedPath[1024]; StringPtr rsrcName = (StringPtr)"\pApplication PList"; getPathToThisApp(path, sizeof(path)); diff --git a/checkin_notes b/checkin_notes index 53cb0dbfa0..7757ee3b8f 100755 --- a/checkin_notes +++ b/checkin_notes @@ -8901,3 +8901,8 @@ Charlie 27 Sep 2007 api/ graphics2_unix.C + mac_icon.C + mac_build/ + boinc.xcodeproj/ + project.pbxproj + diff --git a/mac_build/boinc.xcodeproj/project.pbxproj b/mac_build/boinc.xcodeproj/project.pbxproj index 12c46b477e..95a336eb58 100755 --- a/mac_build/boinc.xcodeproj/project.pbxproj +++ b/mac_build/boinc.xcodeproj/project.pbxproj @@ -3631,6 +3631,7 @@ OTHER_CFLAGS = ( "-DMAC_OS_X_VERSION_MAX_ALLOWED=1040", "-D_THREAD_SAFE", + "-D_DEBUG", "-include", ../clientgui/mac/config.h, ); @@ -3701,6 +3702,7 @@ OTHER_CFLAGS = ( "-DMAC_OS_X_VERSION_MAX_ALLOWED=1040", "-D_THREAD_SAFE", + "-D_DEBUG", "-include", ../clientgui/mac/config.h, ); @@ -3765,7 +3767,7 @@ LIBRARY_STYLE = STATIC; MACOSX_DEPLOYMENT_TARGET = ""; OPTIMIZATION_CFLAGS = "-O0"; - OTHER_CFLAGS = ""; + OTHER_CFLAGS = "-D_DEBUG"; OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)"; OTHER_LDFLAGS = ""; OTHER_REZFLAGS = ""; @@ -4336,7 +4338,10 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = NO; INSTALL_PATH = "$(HOME)/bin"; - OTHER_CFLAGS = "$(inherited)"; + OTHER_CFLAGS = ( + "-D_DEBUG", + "$(inherited)", + ); PREBINDING = NO; PRODUCT_NAME = switcher; ZERO_LINK = NO; @@ -5165,6 +5170,7 @@ OTHER_CFLAGS = ( "-DMAC_OS_X_VERSION_MAX_ALLOWED=1040", "-D_THREAD_SAFE", + "-D_DEBUG", "-include", ../clientgui/mac/config.h, ); @@ -5234,6 +5240,7 @@ OTHER_CFLAGS = ( "-DMAC_OS_X_VERSION_MAX_ALLOWED=1040", "-D_THREAD_SAFE", + "-D_DEBUG", "-include", ../clientgui/mac/config.h, ); @@ -5297,7 +5304,7 @@ LIBRARY_STYLE = STATIC; MACOSX_DEPLOYMENT_TARGET = ""; OPTIMIZATION_CFLAGS = "-O0"; - OTHER_CFLAGS = ""; + OTHER_CFLAGS = "-D_DEBUG"; OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)"; OTHER_LDFLAGS = ""; OTHER_REZFLAGS = ""; @@ -6249,6 +6256,7 @@ OTHER_CFLAGS = ( "-DMAC_OS_X_VERSION_MAX_ALLOWED=1040", "-D_THREAD_SAFE", + "-D_DEBUG", "-include", ../clientgui/mac/config.h, ); @@ -6283,6 +6291,7 @@ OTHER_CFLAGS = ( "-DMAC_OS_X_VERSION_MAX_ALLOWED=1040", "-D_THREAD_SAFE", + "-D_DEBUG", "-include", ../clientgui/mac/config.h, ); @@ -6447,6 +6456,10 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = NO; INSTALL_PATH = "$(HOME)/bin"; + OTHER_CFLAGS = ( + "-D_DEBUG", + "$(inherited)", + ); PREBINDING = NO; PRODUCT_NAME = switcher; ZERO_LINK = NO;