The R Project SVN R-packages

Rev

Rev 8064 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8064 Rev 8068
Line 139... Line 139...
139
		if (realLoc) realLoc = [realLoc stringByExpandingTildeInPath];
139
		if (realLoc) realLoc = [realLoc stringByExpandingTildeInPath];
140
		if (lx) [lx release];
140
		if (lx) [lx release];
141
		SLog(@"PackageInstaller.installSelected: real location=%@", realLoc);
141
		SLog(@"PackageInstaller.installSelected: real location=%@", realLoc);
142
		if (!realLoc || ![[NSFileManager defaultManager] fileExistsAtPath:realLoc]) {
142
		if (!realLoc || ![[NSFileManager defaultManager] fileExistsAtPath:realLoc]) {
143
			if (realLoc && pkgInst==kUserLevel) { // create user-level path if it doesn't exist
143
			if (realLoc && pkgInst==kUserLevel) { // create user-level path if it doesn't exist
-
 
144
				NSError *err = nil;
-
 
145
				[[NSFileManager defaultManager] createDirectoryAtPath:realLoc withIntermediateDirectories:YES attributes:nil error:&err];
-
 
146
				if(err != nil) {
-
 
147
					[self busy: NO];
-
 
148
					NSRunAlertPanel(NLS(@"Package Installer"),NLS(@"User library could not be created."),NLS(@"OK"),nil,nil);
-
 
149
					return;
-
 
150
				}
-
 
151
				// we don't want to re-start R, so add it to .libPaths() since it would have been dropped on init
144
				system([[NSString stringWithFormat:@"mkdir -p %@", realLoc] UTF8String]);
152
				[[REngine mainEngine] evaluateString: [NSString stringWithFormat:@".libPaths(c(%@,.libPaths()))", targetLocation]];
145
			} else {
153
			} else {
146
				[self busy: NO];
154
				[self busy: NO];
147
				NSRunAlertPanel(NLS(@"Package Installer"),NLS(@"The installation location doesn't exist."),NLS(@"OK"),nil,nil);				
155
				NSRunAlertPanel(NLS(@"Package Installer"),NLS(@"The installation location doesn't exist."),NLS(@"OK"),nil,nil);				
148
				return;
156
				return;
149
			}
157
			}