[seed] [extensions] Include the path of the executed script in the default search path



commit 6acb6c0a7f4c1ad730bbe0c289b2dc586eec2ba3
Author: Tim Horton <hortont svn gnome org>
Date:   Tue Jun 23 04:20:33 2009 -0400

    [extensions] Include the path of the executed script in the default search path

 extensions/Seed.js.in |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/extensions/Seed.js.in b/extensions/Seed.js.in
index f85e46a..fd1e639 100644
--- a/extensions/Seed.js.in
+++ b/extensions/Seed.js.in
@@ -165,11 +165,26 @@ Seed.thread_repl = function()
 {
 	GLib.thread_create_full(function() { while(Seed.repl()){} },
 							null, 0, true);
-
 }
 
 Seed.printf = function () { print(Seed.sprintf.apply(this, arguments)) };
 
 if(!imports.searchPath || (imports.searchPath.length == 0))
-	imports.searchPath = ["@GNOME_JS_DIR@", "@prefix@/lib/seed", "@prefix@/share/seed", "/usr/local/lib/seed","/usr/local/share/seed","/usr/lib/seed","/usr/share/seed","."];
-
+{
+	imports.searchPath = [ "@GNOME_JS_DIR@",
+	                       "@prefix@/lib/seed",
+	                       "@prefix@/share/seed",
+	                       "/usr/local/lib/seed",
+	                       "/usr/local/share/seed",
+	                       "/usr/lib/seed",
+	                       "/usr/share/seed",
+	                       "."];
+
+	if(Seed.argv.length > 1)
+	{
+		var script_path = imports.gi.GLib.path_get_dirname(Seed.argv[1]);
+		
+		if(script_path && script_path != "")
+			imports.searchPath.push(script_path);
+	}
+}
\ No newline at end of file



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]