Fix #8028 - language server performance, fix warnings and critical errors
[roobuilder] / src / Palete / ValaCompileRequest.vala
index 62319fb..5c05eba 100644 (file)
@@ -64,9 +64,14 @@ namespace Palete {
                        if (GLib.FileUtils.test(this.project.path + "/build/meson-info", GLib.FileTest.EXISTS)) {
                                return 0; //assume it's been set up.
                        }
-                       string[] args = { "/usr/bin/meson" ,"setup", "build", "--prefix=/" };           
+                       var exe = GLib.Environment.find_program_in_path( "meson");
+                       string[] args = { exe ,"setup", "build", "--prefix=/usr" };             
                        GLib.debug("running meson");
-                       this.spawn = new Spawn(this.project.path , args);
+                       try {
+                               this.spawn = new Spawn(this.project.path , args);
+                       } catch (GLib.Error e) {
+                               return -1;
+                       }
                        this.spawn.output_line.connect(( str) => {
                                this.onOutput(str);
                        });
@@ -80,9 +85,13 @@ namespace Palete {
                                GLib.debug("build is missing");
                                return -1; //assume it's been set up.
                        }
-                       string[] args = { "/usr/bin/ninja"};            
-
-                       this.spawn = new Spawn(this.project.path + "/build" , args);
+                       var exe = GLib.Environment.find_program_in_path( "ninja");
+                       string[] args = { exe };                
+                       try {
+                               this.spawn = new Spawn(this.project.path + "/build" , args);
+                       } catch (GLib.Error e) {
+                               return -1;
+                       }
                        this.spawn.output_line.connect(( str) => {
                                this.onOutput(str);
                        });
@@ -178,9 +187,10 @@ namespace Palete {
                        if (!GLib.FileUtils.test(gdb_cfg, GLib.FileTest.EXISTS)) {
                                pr.writeFile("build/.gdb-script", "set debuginfod enabled off\nr");
                        }
-                        
+                       var gdb = GLib.Environment.find_program_in_path( "gdb"); 
+                       var term = GLib.Environment.find_program_in_path( "gnome-terminal"); 
                        
-                       string[] args = "/usr/bin/gnome-terminal --disable-factory --wait -- /usr/bin/gdb -x".split(" ");
+                       string[] args = @"$term --disable-factory --wait -- $gdb -x".split(" ");
 
                        args+= gdb_cfg;