src/Project/Gtk.vala
[app.Builder.js] / src / Project / Gtk.vala
index f0da3ee..67409ae 100644 (file)
@@ -132,16 +132,23 @@ namespace Project {
                        }
         
                }
+                
+               
                public Gee.ArrayList<string> files(string in_path)
                {
-                       var ret = new Gee.ArrayList<string>(); 
+                       var ret =  new Gee.ArrayList<string>();
+                       var cfiles =  new Gee.ArrayList<string>();
+                       
                        var dirname = this.resolve_path(
                                this.resolve_path_combine_path(this.firstPath(),in_path));
+                       
+                       print("SCAN %s\n", dirname);
                                // scan the directory for files -- ending with vala || c
                        
 
                        var dir = File.new_for_path(dirname);
                        if (!dir.query_exists()) {
+                               print("SCAN %s - skip - does not exist\n", dirname);
                                return ret;
                        }
          
@@ -157,8 +164,10 @@ namespace Project {
                                FileInfo next_file; 
                                while ((next_file = file_enum.next_file(null)) != null) {
                                        var fn = next_file.get_display_name();
+                                       
+                                       print("SCAN %s - checking %s\n", dirname, fn);
                                        if (Regex.match_simple("\\.vala$", fn)) {
-                                               ret.add(dirname + "/" + fn);
+                                               ret.add(in_path + "/" + fn);
                                                continue;
                                        }
                                        
@@ -168,21 +177,30 @@ namespace Project {
                                                
                                                // if we have a vala file with the same name 
                                                // then do not add it...
-                                               var vv = (new Regex("\\.c$").replace(fn, fn.legnth, 0, ".vala");
-                                               if (ret.index_of(vv) > -1) {
-                                                       continue;
-                                               }
                                                
-                                               ret.add(dirname + "/" + fn);
+                                               cfiles.add(in_path + "/" + fn);
                                                continue;
                                        }
                                        // any other valid types???
                                
-                               }       
+                               }
+                               // add the cfiles to ret - if they do not have a vala...
+                               for (var i = 0; i < cfiles.size; i ++) {
+                                       
+                                       var vv = (new Regex("\\.c$")).replace(  
+                                                       cfiles.get(i), cfiles.get(i).length, 0, ".vala");
+                                                       
+                                       if (ret.index_of( vv) > -1) {
+                                               continue;
+                                       }
+                                       ret.add(cfiles.get(i));
+                               }
+                                               
+                                      
                        } catch(Error e) {
                                print("oops - something went wrong scanning the projects\n");
                        }
-
+                       print("SCAN %s = returning %d", dirname, ret.size);
                         
                        return ret;
                        
@@ -197,6 +215,7 @@ namespace Project {
                        {
                                ret += "/";
                        }
+                       print("combined path = %s",  ret + second);
                        return ret + second;
                }
                public   string  resolve_path_times(string part, int times, string? clue = null)
@@ -254,7 +273,24 @@ namespace Project {
                        return path;
                }
                
-               
+               public string[] vapidirs()
+               {
+                       string[] ret = {};
+                       var sources = this.compilegroups.get("_default_").sources;
+                       for(var i =0; i< sources.size; i++) {
+                               
+                               var path = this.resolve_path(
+                               this.resolve_path_combine_path(this.firstPath(),sources.get(i)));
+                               
+                               if (Path.get_basename (path) == "vapi") {
+                                       print("Adding VAPIDIR: %s\n", path);
+                                       ret += path;
+                               }
+                               
+                       }
+                       return ret;
+                       
+               }
                        
 
        }
@@ -291,6 +327,9 @@ namespace Project {
                        this.packages = this.readArray(el.get_array_member("packages"));
                        
                }
+               
+               
+               
                public Gee.ArrayList<string> readArray(Json.Array ar) 
                {
                        var ret = new Gee.ArrayList<string>();