[52375] branches/gsoc09-gui/MacPorts_Framework
juanger at macports.org
juanger at macports.org
Sun Jun 14 22:19:44 PDT 2009
Revision: 52375
http://trac.macports.org/changeset/52375
Author: juanger at macports.org
Date: 2009-06-14 22:19:43 -0700 (Sun, 14 Jun 2009)
Log Message:
-----------
BUGFIX: Now only the Tcl interpreter changes when changing PKGPath.
Modified Paths:
--------------
branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.h
branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.m
branches/gsoc09-gui/MacPorts_Framework/MPMacPorts.h
branches/gsoc09-gui/MacPorts_Framework/MPMacPorts.m
Modified: branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.h
===================================================================
--- branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.h 2009-06-15 04:53:14 UTC (rev 52374)
+++ branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.h 2009-06-15 05:19:43 UTC (rev 52375)
@@ -108,6 +108,8 @@
//Internal methods
-(BOOL) setOptionsForNewTclPort:(NSArray *)options;
+-(BOOL) resetTclInterpreterWithPath:(NSString *)path;
+
/*!
@brief Return singleton shared MPInterpreter instance
*/
Modified: branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.m
===================================================================
--- branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.m 2009-06-15 04:53:14 UTC (rev 52374)
+++ branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.m 2009-06-15 05:19:43 UTC (rev 52375)
@@ -169,7 +169,13 @@
}
+(void) setPKGPath:(NSString*)newPath {
- PKGPath = newPath;
+ if([PKGPath isNotEqualTo:newPath]) {
+ [PKGPath release];
+ PKGPath = [newPath copy];
+ //I should check if interp is nil. *not needed now
+ MPInterpreter *interp = (MPInterpreter*) [[[NSThread currentThread] threadDictionary] objectForKey:@"sharedMPInterpreter"];
+ [interp resetTclInterpreterWithPath:PKGPath];
+ }
}
#pragma mark -
@@ -267,6 +273,11 @@
return (result && tempResult) ;
}
+-(BOOL) resetTclInterpreterWithPath:(NSString*) path {
+ Tcl_DeleteInterp(_interpreter);
+ return [self initTclInterpreter:&_interpreter withPath:PKGPath];
+}
+
- (id) initWithPkgPath:(NSString *)path portOptions:(NSArray *)options {
if (self = [super init]) {
[self initTclInterpreter:&_interpreter withPath:path];
@@ -304,8 +315,11 @@
+ (MPInterpreter*)sharedInterpreterWithPkgPath:(NSString *)path portOptions:(NSArray *)options {
@synchronized(self) {
- if ([[[NSThread currentThread] threadDictionary] objectForKey:@"sharedMPInterpreter"] == nil
- || [PKGPath isNotEqualTo:path] ) {
+ if ([PKGPath isNotEqualTo:path]) {
+ [self setPKGPath:path];
+ }
+
+ if ([[[NSThread currentThread] threadDictionary] objectForKey:@"sharedMPInterpreter"] == nil) {
[[self alloc] initWithPkgPath:path portOptions:options]; // assignment not done here
}
}
Modified: branches/gsoc09-gui/MacPorts_Framework/MPMacPorts.h
===================================================================
--- branches/gsoc09-gui/MacPorts_Framework/MPMacPorts.h 2009-06-15 04:53:14 UTC (rev 52374)
+++ branches/gsoc09-gui/MacPorts_Framework/MPMacPorts.h 2009-06-15 05:19:43 UTC (rev 52375)
@@ -76,6 +76,10 @@
}
++ (NSString*) PKGPath;
+
++ (void) setPKGPath:(NSString*)newPath;
+
/*!
@brief Returns an MPMacPorts object that represents the MacPorts system on user's machine.
*/
Modified: branches/gsoc09-gui/MacPorts_Framework/MPMacPorts.m
===================================================================
--- branches/gsoc09-gui/MacPorts_Framework/MPMacPorts.m 2009-06-15 04:53:14 UTC (rev 52374)
+++ branches/gsoc09-gui/MacPorts_Framework/MPMacPorts.m 2009-06-15 05:19:43 UTC (rev 52375)
@@ -51,6 +51,14 @@
return self;
}
++(NSString*) PKGPath {
+ return [MPInterpreter PKGPath];
+}
+
++(void) setPKGPath:(NSString*)newPath {
+ [MPInterpreter setPKGPath:newPath];
+}
+
+ (MPMacPorts *)sharedInstance {
return [self sharedInstanceWithPkgPath:[MPInterpreter PKGPath] portOptions:nil];
}
@@ -60,8 +68,11 @@
if ([path isEqual:nil]) {
path = [MPInterpreter PKGPath];
}
- if ([[[NSThread currentThread] threadDictionary] objectForKey:@"sharedMPMacPorts"] == nil
- || [[MPInterpreter PKGPath] isNotEqualTo:path] ) {
+ if ([[MPInterpreter PKGPath] isNotEqualTo:path]) {
+ [self setPKGPath:path];
+ }
+
+ if ([[[NSThread currentThread] threadDictionary] objectForKey:@"sharedMPMacPorts"] == nil) {
[[self alloc] initWithPkgPath:path portOptions:options ]; // assignment not done here
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090614/66d0c8cb/attachment-0001.html>
More information about the macports-changes
mailing list