[86930] contrib/Pallet/MPActionsController.m

jmr at macports.org jmr at macports.org
Sun Nov 6 23:53:31 PST 2011


Revision: 86930
          http://trac.macports.org/changeset/86930
Author:   jmr at macports.org
Date:     2011-11-06 23:53:28 -0800 (Sun, 06 Nov 2011)
Log Message:
-----------
Pallet: get default Tcl package path from MacPorts.framework when no value previously set

Modified Paths:
--------------
    contrib/Pallet/MPActionsController.m

Modified: contrib/Pallet/MPActionsController.m
===================================================================
--- contrib/Pallet/MPActionsController.m	2011-11-07 07:22:31 UTC (rev 86929)
+++ contrib/Pallet/MPActionsController.m	2011-11-07 07:53:28 UTC (rev 86930)
@@ -313,7 +313,24 @@
     NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
     NSString *pkgPath = [defaults objectForKey:@"PKGPath"];
     if (pkgPath == nil) {
-        [self openPreferences:self];
+        NSFileManager *fileManager = [NSFileManager defaultManager];
+        BOOL existsAsDirectory = NO;
+        BOOL containsMacPortsTcl = NO;
+        NSString *macportsDir;
+        NSString *macportsFile;
+        macportsDir = [[MPMacPorts PKGPath] stringByAppendingPathComponent:@"macports1.0"];
+        macportsFile = [macportsDir stringByAppendingPathComponent:@"macports.tcl"];
+        [fileManager fileExistsAtPath:macportsDir isDirectory:&existsAsDirectory];
+        if (existsAsDirectory) {
+		    containsMacPortsTcl = [fileManager fileExistsAtPath:macportsFile isDirectory:nil];
+	    }
+        if (containsMacPortsTcl) {
+            [defaults setObject:[MPMacPorts PKGPath] forKey:@"PKGPath"];
+            [[MPActionLauncher sharedInstance]
+                    performSelectorInBackground:@selector(loadPorts) withObject:nil];
+        } else {
+            [self openPreferences:self];
+        }
     } else {
         [MPMacPorts setPKGPath:pkgPath];
         [[MPActionLauncher sharedInstance]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20111106/7dc4cae8/attachment.html>


More information about the macports-changes mailing list