[30901] users/rhwood/MacPorts.Framework
source_changes at macosforge.org
source_changes at macosforge.org
Sat Nov 10 11:31:34 PST 2007
Revision: 30901
http://trac.macosforge.org/projects/macports/changeset/30901
Author: rhwood at macports.org
Date: 2007-11-10 11:31:34 -0800 (Sat, 10 Nov 2007)
Log Message:
-----------
Add methods to get the files associated with a port and to return a list of the names of installed ports.
Modified Paths:
--------------
users/rhwood/MacPorts.Framework/MPRegistery.h
users/rhwood/MacPorts.Framework/MPRegistery.m
Modified: users/rhwood/MacPorts.Framework/MPRegistery.h
===================================================================
--- users/rhwood/MacPorts.Framework/MPRegistery.h 2007-11-10 19:20:20 UTC (rev 30900)
+++ users/rhwood/MacPorts.Framework/MPRegistery.h 2007-11-10 19:31:34 UTC (rev 30901)
@@ -47,8 +47,25 @@
+ (MPRegistery *)sharedRegistery;
+/*
+ * Call [self installed:@""]
+ */
- (NSDictionary *)installed;
+/*
+ * Call [self installed:name version:@""]
+ */
- (NSDictionary *)installed:(NSString *)name;
+/*
+ * Returns a NSDictionary of MPReciepts keyed by port name
+ */
- (NSDictionary *)installed:(NSString *)name withVersion:(NSString *)version;
+/*
+ * Return an array of installed port names
+ */
+- (NSArray *)installedAsArray:(NSString *)name withVersion:(NSString *)version;
+/*
+ * Return an array of the files in the (installed and active) port
+ */
+- (NSArray *)filesForPort:(NSString *)name;
@end
Modified: users/rhwood/MacPorts.Framework/MPRegistery.m
===================================================================
--- users/rhwood/MacPorts.Framework/MPRegistery.m 2007-11-10 19:20:20 UTC (rev 30900)
+++ users/rhwood/MacPorts.Framework/MPRegistery.m 2007-11-10 19:31:34 UTC (rev 30901)
@@ -99,13 +99,7 @@
NSEnumerator *rawEnumerator;
NSArray *versions;
id item;
- raw = [interpreter arrayFromTclListAsString:[interpreter evaluateArrayAsString:[NSArray arrayWithObjects:
- @"return [registry::installed",
- name,
- version,
- @"]",
- nil
- ]]];
+ raw = [self installedAsArray:name withVersion:version];
result = [[NSMutableDictionary alloc] initWithCapacity:[raw count]];
rawEnumerator = [raw objectEnumerator];
while (item = [rawEnumerator nextObject]) {
@@ -121,4 +115,24 @@
}
return result;
}
+
+- (NSArray *)installedAsArray:(NSString *)name withVersion:(NSString *)version {
+ return [interpreter arrayFromTclListAsString:[interpreter evaluateArrayAsString:[NSArray arrayWithObjects:
+ @"return [registry::installed",
+ name,
+ version,
+ @"]",
+ nil
+ ]]];
+}
+
+- (NSArray *)filesForPort:(NSString *)name {
+ return [interpreter arrayFromTclListAsString:[interpreter evaluateArrayAsString:[NSArray arrayWithObjects:
+ @"return [registry::port_registered",
+ name,
+ @"]",
+ nil
+ ]]];
+}
+
@end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20071110/12e09752/attachment.html
More information about the macports-changes
mailing list