[28892] users/rhwood/Pallet
source_changes at macosforge.org
source_changes at macosforge.org
Mon Sep 10 18:58:58 PDT 2007
Revision: 28892
http://trac.macosforge.org/projects/macports/changeset/28892
Author: rhwood at macports.org
Date: 2007-09-10 18:58:58 -0700 (Mon, 10 Sep 2007)
Log Message:
-----------
Use [MPMacPorts prefix] to get the MacPorts prefix instead of storing that value as a preference.
Use [MPMacPorts sources] to get the MacPorts sources list instead of parsing sources.conf.
Modified Paths:
--------------
users/rhwood/Pallet/English.lproj/MainMenu.nib/info.nib
users/rhwood/Pallet/English.lproj/MainMenu.nib/keyedobjects.nib
users/rhwood/Pallet/PortAuthority.h
users/rhwood/Pallet/PortAuthority.m
Modified: users/rhwood/Pallet/English.lproj/MainMenu.nib/info.nib
===================================================================
--- users/rhwood/Pallet/English.lproj/MainMenu.nib/info.nib 2007-09-10 23:03:44 UTC (rev 28891)
+++ users/rhwood/Pallet/English.lproj/MainMenu.nib/info.nib 2007-09-11 01:58:58 UTC (rev 28892)
@@ -27,10 +27,10 @@
</array>
<key>IBOpenObjects</key>
<array>
+ <integer>29</integer>
<integer>568</integer>
<integer>21</integer>
<integer>290</integer>
- <integer>29</integer>
</array>
<key>IBSystem Version</key>
<string>8R218</string>
Modified: users/rhwood/Pallet/English.lproj/MainMenu.nib/keyedobjects.nib
===================================================================
(Binary files differ)
Modified: users/rhwood/Pallet/PortAuthority.h
===================================================================
--- users/rhwood/Pallet/PortAuthority.h 2007-09-10 23:03:44 UTC (rev 28891)
+++ users/rhwood/Pallet/PortAuthority.h 2007-09-11 01:58:58 UTC (rev 28892)
@@ -65,7 +65,6 @@
int portCommand;
NSString *lastOutput;
NSString *launcher;
- NSString *macPortsPath;
NSString *macPortsPort;
AuthorizedExecutable *agentTask;
AuthorizedExecutable *authPortTask;
Modified: users/rhwood/Pallet/PortAuthority.m
===================================================================
--- users/rhwood/Pallet/PortAuthority.m 2007-09-10 23:03:44 UTC (rev 28891)
+++ users/rhwood/Pallet/PortAuthority.m 2007-09-11 01:58:58 UTC (rev 28892)
@@ -47,8 +47,7 @@
// Get a MacPorts Interpeter
macPorts = [[MPMacPorts alloc] init];
// Load/set preferences/defaults
- if (![[[NSUserDefaultsController sharedUserDefaultsController] values] valueForKey:@"portInstallationPath"]) {
- [[[NSUserDefaultsController sharedUserDefaultsController] values] setValue:@"/opt/local" forKey:@"portInstallationPath"];
+ if (![[[NSUserDefaultsController sharedUserDefaultsController] values] valueForKey:@"synchronizePortsListOnStartup"]) {
NSString *userDefaultsValuesPath;
NSDictionary *userDefaultsValuesDict;
userDefaultsValuesPath = [[NSBundle mainBundle] pathForResource:@"UserDefaults"
@@ -61,8 +60,7 @@
[portsWindow setExcludedFromWindowsMenu:YES];
[portLogWindow setExcludedFromWindowsMenu:YES];
// Locate port
- macPortsPath = [[[NSUserDefaultsController sharedUserDefaultsController] values] valueForKey:@"portInstallationPath"];
- macPortsPort = [[NSString alloc] initWithString:[macPortsPath stringByAppendingPathComponent:@"bin/port"]];
+ macPortsPort = [[NSString alloc] initWithString:[[macPorts prefix] stringByAppendingPathComponent:@"bin/port"]];
// Initialize the port settings cache
portSettings = [[NSMutableDictionary alloc] init];
// Clean the main window
@@ -132,35 +130,15 @@
- (void)getPortIndexes
{
- NSArray *conf;
- NSString *path;
- NSString *file;
NSMutableDictionary *sources;
NSEnumerator *enumerator;
- id line;
- NSMutableString *source;
+ id source;
- source = [[NSMutableString alloc] init];
sources = [[NSMutableDictionary alloc] init];
- path = [macPortsPath stringByAppendingPathComponent:@"etc/macports/sources.conf"];
- file = [[NSString alloc] initWithContentsOfFile:path];
- conf = [[NSArray alloc] initWithArray:[file componentsSeparatedByString:@"\n"]];
- if ([conf count] == 1) {
- [conf release];
- conf = [[NSArray alloc] initWithArray:[file componentsSeparatedByString:@"\r"]];
+ enumerator = [[macPorts sources] objectEnumerator];
+ while (source = [enumerator nextObject]) {
+ [sources setValue:[self pathToPortIndexWithSource:source] forKey:source];
}
- enumerator = [conf objectEnumerator];
- while (line = [enumerator nextObject]) {
- @try {
- if ([line characterAtIndex:0] != '#') {
- [sources setValue:[self pathToPortIndexWithSource:line] forKey:line];
- }
- }
- @catch (NSException *exception) {
- // Exceptions will be thrown where line is nil or 0 length
- // Ignore the exception since it means only that the line was empty
- }
- }
if (portIndexes != nil) {
[portIndexes release];
}
@@ -176,7 +154,7 @@
[path setString:[source substringFromIndex:(range.location + range.length)]];
// if the source URL is not a file:// type URL, prepend it with ${prefix}/var/macports/sources
if (![[source substringToIndex:4] isEqualToString:@"file"]) {
- [path setString:[[macPortsPath stringByAppendingPathComponent:@"var/macports/sources"] stringByAppendingPathComponent:path]];
+ [path setString:[[[macPorts prefix] stringByAppendingPathComponent:@"var/macports/sources"] stringByAppendingPathComponent:path]];
}
return [path stringByAppendingPathComponent:@"PortIndex"];
}
@@ -331,7 +309,7 @@
if ([portSettings valueForKey:setting] == nil) {
int tclResult;
Tcl_Interp *tcl;
- NSString *script = [[NSString alloc] initWithFormat:@"source %@/etc/macports/macports.conf\nproc %@ x {puts [list %2$@ $x]}", macPortsPath, setting, nil];
+ NSString *script = [[NSString alloc] initWithFormat:@"source %@/etc/macports/macports.conf\nproc %@ x {puts [list %2$@ $x]}", [macPorts prefix], setting, nil];
NSLog(script);
tcl = Tcl_CreateInterp();
tclResult = Tcl_EvalEx(tcl, [script cString], -1, TCL_EVAL_GLOBAL);
@@ -537,7 +515,7 @@
NSMutableAttributedString *credits;
NSMutableString *version;
- version = [NSMutableString stringWithContentsOfFile:[macPortsPath stringByAppendingPathComponent:@"etc/ports/dp_version"]];
+ version = [NSMutableString stringWithContentsOfFile:[[macPorts prefix] stringByAppendingPathComponent:@"etc/ports/dp_version"]];
[version deleteCharactersInRange:NSMakeRange([version length] - 1, 1)];
credits = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:
NSLocalizedStringFromTable(@"MacPorts Version: %@",
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070910/f70f7aac/attachment.html
More information about the macports-changes
mailing list