=================================================================== RCS file: /home/cvs/OpenXM/src/cfep/MyEnvironment.m,v retrieving revision 1.1.1.1 retrieving revision 1.6 diff -u -p -r1.1.1.1 -r1.6 --- OpenXM/src/cfep/MyEnvironment.m 2006/03/03 23:31:12 1.1.1.1 +++ OpenXM/src/cfep/MyEnvironment.m 2016/10/07 02:02:31 1.6 @@ -127,6 +127,26 @@ }else{ [myUnixEnvironment setObject: s forKey: @"DYLD_LIBRARY_PATH"]; } + + s = NSHomeDirectory(); + [myUnixEnvironment setObject: s forKey: @"HOME"]; + + s = NSLocalizedString(@"PATH",nil); + if ([s compare: @"PATH"] == NSOrderedSame) { + char *path; + NSString *defaultPath; + defaultPath=@"/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/sw/bin:/sw/sbin:/usr/local/bin"; + path = getenv("PATH"); + if (!path) { + s = [NSString stringWithCString: path length: strlen(path)]; + s = [s stringByAppendingString: @":"]; + s = [s stringByAppendingString: defaultPath]; + [myUnixEnvironment setObject: s forKey: @"PATH"]; + } else [myUnixEnvironment setObject: defaultPath forKey: @"PATH"]; + } else { + [myUnixEnvironment setObject: s forKey: @"PATH"]; + } + myDefaultTypingAttributes= [NSDictionary dictionaryWithObject: [NSFont fontWithName: @"Courier" size: 12] forKey: @"NSFont"]; @@ -150,16 +170,17 @@ [super dealloc]; } +(int) checkX { + /* still use an deprecated functions */ NSEnumerator *apps = [[[NSWorkspace sharedWorkspace] launchedApplications] objectEnumerator ]; NSDictionary *dicApp; while (dicApp = [apps nextObject]) { - if ([@"X11" compare: [dicApp objectForKey: @"NSApplicationName"]] == NSOrderedSame) { + if ([@"XQuartz" compare: [dicApp objectForKey: @"NSApplicationName"]] == NSOrderedSame) { NSLog(@"X11 is running.\n"); return 1; } } NSLog(@"X11 is NOT running.\n"); - return 0; + return 0; } -(void) showForDebug { NSLog(@"OpenXM_HOME=%@\n",OpenXM_HOME); @@ -195,6 +216,17 @@ -(NSDictionary *)getMyDefaultTypingAttributes { return myDefaultTypingAttributes; } ++(int) isX11Installed { + NSFileManager *manager = [NSFileManager defaultManager]; + if ([manager fileExistsAtPath: @"/opt/X11/bin/X"]) return 1; + else return 0; +} ++(int) isGccInstalled { + NSFileManager *manager = [NSFileManager defaultManager]; + if ([manager fileExistsAtPath: @"/usr/bin/gcc"]) return 1; + else return 0; +} + @end