[86927] contrib/MacPorts_Framework/MPInterpreter.m

jmr at macports.org jmr at macports.org
Sun Nov 6 22:54:11 PST 2011


Revision: 86927
          http://trac.macports.org/changeset/86927
Author:   jmr at macports.org
Date:     2011-11-06 22:54:09 -0800 (Sun, 06 Nov 2011)
Log Message:
-----------
MacPorts_Framework: check for macports1.0 under /opt/local/share/macports/Tcl as well as /Library/Tcl (#27911)

Modified Paths:
--------------
    contrib/MacPorts_Framework/MPInterpreter.m

Modified: contrib/MacPorts_Framework/MPInterpreter.m
===================================================================
--- contrib/MacPorts_Framework/MPInterpreter.m	2011-11-07 06:45:13 UTC (rev 86926)
+++ contrib/MacPorts_Framework/MPInterpreter.m	2011-11-07 06:54:09 UTC (rev 86927)
@@ -39,7 +39,8 @@
 #include "MPHelperCommon.h"
 #include "MPHelperNotificationsProtocol.h"
 static AuthorizationRef internalMacPortsAuthRef;
-static NSString* PKGPath = @"/Library/Tcl";
+static NSString* GenericPKGPath = @"/Library/Tcl";
+static NSString* PKGPath = @"/opt/local/share/macports/Tcl";
 static NSTask* aTask;
 
 #pragma mark -
@@ -303,6 +304,18 @@
 
 #pragma mark API methods
 - (id) init {
+	NSFileManager *fileManager = [NSFileManager defaultManager];
+	BOOL existsAsDirectory = NO;
+	BOOL containsMacPortsTcl = NO;
+	NSString *macportsDir = [PKGPath stringByAppendingPathComponent:@"macports1.0"];
+	NSString *macportsFile = [macportsDir stringByAppendingPathComponent:@"macports.tcl"];
+	[fileManager fileExistsAtPath:macportsDir isDirectory:&existsAsDirectory];
+	if (existsAsDirectory) {
+		containsMacPortsTcl = [fileManager fileExistsAtPath:macportsFile isDirectory:nil];
+	}
+	if (!containsMacPortsTcl) {
+		return [self initWithPkgPath:GenericPKGPath portOptions:nil];
+	}
 	return [self initWithPkgPath:PKGPath portOptions:nil];
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20111106/f686a9e6/attachment.html>


More information about the macports-changes mailing list