fixed a BUG when sclang somethimes didn't read my /usr/bin/local path and thus not find my mate command. added a matePath classvar to Textmate.sc

This commit is contained in:
Stephen Lumenta 2009-04-25 15:09:35 +02:00 committed by Rob Watson
parent 53d22df833
commit 326c83c145
1 changed files with 18 additions and 7 deletions

View File

@ -64,12 +64,20 @@ TextMate {
// adapted from http://github.com/rfwatson/sc3ctrl // adapted from http://github.com/rfwatson/sc3ctrl
SC3Controller { SC3Controller {
classvar nodes; classvar nodes, <>matePath;
*initClass { *initClass {
nodes = List[]; nodes = List[];
Platform.case(\osx) { Platform.case(\osx) {
var whichMate = "which mate".unixCmdGetStdOut;
if(whichMate.isEmpty){
matePath = "/usr/local/bin/mate";
} {
matePath = whichMate;
};
StartUp.add { StartUp.add {
this.addListeners; this.addListeners;
} }
@ -116,11 +124,14 @@ SC3Controller {
var content = f.readAllString; var content = f.readAllString;
var split = content.split($:); var split = content.split($:);
if("^[0-9]+$".matchRegexp(split.first.asString)) { if("^[0-9]+$".matchRegexp(split.first.asString)) {
("mate -l" ++ split.first + "\"" ++ fname ++ "\"").unixCmd(postOutput: false); (matePath ++ " -l"++ split.first + "\"" ++ fname ++ "\"").unixCmd(postOutput: false);
} { } {
("mate -l1 \"" ++ fname ++ "\"").unixCmd(postOutput: false); (matePath ++ " -l1 \"" ++ fname ++ "\"").unixCmd(postOutput: false);
} };
f.close;
}; };
}); });
} }
} { // open in SC.app } { // open in SC.app
@ -223,7 +234,7 @@ SC3Controller {
fname = "/tmp/" ++ Date.seed ++ ".sc"; fname = "/tmp/" ++ Date.seed ++ ".sc";
File.use(fname, "w") { |f| File.use(fname, "w") { |f|
f << out.collection.asString; f << out.collection.asString;
("mate" + fname).unixCmd(postOutput: false); (matePath + fname).unixCmd(postOutput: false);
}; };
} { } {
out.collection.newTextWindow(name.asString); out.collection.newTextWindow(name.asString);
@ -246,7 +257,7 @@ SC3Controller {
fname = "/tmp/" ++ Date.seed ++ ".sc"; fname = "/tmp/" ++ Date.seed ++ ".sc";
File.use(fname, "w") { |f| File.use(fname, "w") { |f|
f << out.collection.asString; f << out.collection.asString;
("mate" + fname).unixCmd(postOutput: false); (matePath + fname).unixCmd(postOutput: false);
}; };
} { } {
out.collection.newTextWindow(name.asString); out.collection.newTextWindow(name.asString);