src/Project/Gtk.vala
[app.Builder.js] / src / Project / Gtk.vala
index b2c5dba..5e0061f 100644 (file)
@@ -170,7 +170,7 @@ namespace Project {
                        var dirname = this.resolve_path(
                                this.resolve_path_combine_path(this.firstPath(),in_path));
                        
-                       GLib.debug("SCAN %s\n", dirname);
+                       GLib.debug("SCAN %s", dirname);
                                // scan the directory for files -- ending with vala || c
                        
 
@@ -193,8 +193,10 @@ namespace Project {
                                while ((next_file = file_enum.next_file(null)) != null) {
                                        var fn = next_file.get_display_name();
                                        
-                                       GLib.debug("SCAN %s - checking %s\n", dirname, fn);
-                                        
+                                       GLib.debug("SCAN ADD %s - checking %s\n", dirname, fn);
+                                       if (!GLib.FileUtils.test(in_path + "/" + fn, GLib.FileTest.IS_REGULAR)) {
+                                               continue;
+                                       }
                                        ret.add(in_path + "/" + fn);
                                         
                                        // any other valid types???
@@ -210,7 +212,7 @@ namespace Project {
                
                public Gee.ArrayList<string> filesForCompile(string in_path)
                {
-                       var allfile = this.fileAll();
+                       var allfiles = this.filesAll(in_path);
                        var ret =  new Gee.ArrayList<string>();
                        
                        
@@ -234,7 +236,7 @@ namespace Project {
                                        
                                         
                                        
-                                       var vv = (new Regex("\\.c$")).replace( fn, fn, 0, ".vala");
+                                       var vv = (new Regex("\\.c$")).replace( fn, fn.length, 0, ".vala");
                                
                                        
                                                
@@ -249,7 +251,7 @@ namespace Project {
                        }
                        // sort.
                        ret.sort((fa,fb) => {
-                               return ((string)fa).collate(string) fb);
+                               return ((string)fa).collate((string) fb);
                        });
                        return ret;
                        
@@ -257,28 +259,44 @@ namespace Project {
                
                public Gee.ArrayList<string> filesForOpen(string in_path)
                {
-                       var allfiles = this.fileAll();
+                       var allfiles = this.filesAll(in_path);
                        var ret =  new Gee.ArrayList<string>();
-                       
+                       GLib.debug("SCAN %s - %d files",in_path, allfiles.size);
                        
                        for (var i = 0; i < allfiles.size; i ++) {
-                               var fn = cfiles.get(i);
+                               var fn = allfiles.get(i);
                                try {
                                        
                                        if (Regex.match_simple("\\.vala\\.c$", fn)) {
+                                               GLib.debug("SKIP %s - vala.c",fn);
+
                                                continue;
                                        }
                                        
                                        if (Regex.match_simple("\\.bjs$", fn)) {
+                                               GLib.debug("SKIP %s - .bjs",fn);
+                                               continue;
+                                       }
+                                       if (Regex.match_simple("\\.o$", fn)) {
+                                               GLib.debug("SKIP %s - .o",fn);
+                                               continue;
+                                       }
+                                       if (Regex.match_simple("\\~$", fn)) {
+                                               GLib.debug("SKIP %s - ~",fn);
                                                continue;
                                        }
                                        
+                                       if (Regex.match_simple("^\\.", GLib.Path.get_basename(fn))) {
+                                               GLib.debug("SKIP %s - hidden",fn);
+                                               continue;
+                                       }
                                        if (Regex.match_simple("\\.vala$", fn)) {
-                                               var vv = (new Regex("\\.vala$")).replace( fn, fn, 0, ".bjs");
+                                               var vv = (new Regex("\\.vala$")).replace( fn, fn.length, 0, ".bjs");
                                                if (allfiles.index_of( vv) > -1) {
+                                                       GLib.debug("SKIP %s - .vala (got bjs)",fn);
                                                        continue;
                                                }
-                                               
+                                               GLib.debug("ADD %s",fn);
                                                ret.add( fn);
                                                continue;
                                        }
@@ -287,10 +305,12 @@ namespace Project {
                                        // not a c file...
                                        if (Regex.match_simple("\\.c$", fn)) {
                                                
-                                               var vv = (new Regex("\\.c$")).replace( fn, fn, 0, ".vala");
+                                               var vv = (new Regex("\\.c$")).replace( fn, fn.length, 0, ".vala");
                                                if (allfiles.index_of( vv) > -1) {
+                                                       GLib.debug("SKIP %s - .c (got vala)",fn);
                                                        continue;
                                                }
+                                               GLib.debug("ADD %s",fn);                                                
                                                ret.add( fn);
                                                continue;
                                        }
@@ -300,7 +320,7 @@ namespace Project {
                                        }
                                        // not .c / not .vala /not .bjs.. -- other type of file..
                                        // allow ???
-                                       
+                                       GLib.debug("ADD %s",fn);
                                        // add the 'c' file..
                                        ret.add(fn);
                                } catch (Error e) {
@@ -309,7 +329,7 @@ namespace Project {
                        }
                        // sort.
                        ret.sort((fa,fb) => {
-                               return ((string)fa).collate(string) fb);
+                               return ((string)fa).collate((string) fb);
                        });
                        return ret;