src/Builder4/ClutterFiles.bjs
[app.Builder.js] / src / Project / Gtk.vala
index be08b76..706fe68 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
                        
 
@@ -183,7 +183,7 @@ namespace Project {
           
                        try {
                                var file_enum = dir.enumerate_children(
-                                       GLib.FileAttribute.STANDARD_DISPLAY_NAME
+                                       "standard::*"
                                        GLib.FileQueryInfoFlags.NONE, 
                                        null
                                );
@@ -193,8 +193,15 @@ 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);
+                                       if (next_file.get_file_type () == GLib.FileType.DIRECTORY) {
                                         
+                                               GLib.debug("SKIP %s not regular  ", fn);
+                                               continue;
+                                       }
+                                       if (!Regex.match_simple("^text", next_file.get_content_type())) {
+                                               continue;
+                                       }
+                                       GLib.debug("SCAN ADD %s : %s", fn, next_file.get_content_type());
                                        ret.add(in_path + "/" + fn);
                                         
                                        // any other valid types???
@@ -259,31 +266,61 @@ namespace Project {
                {
                        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 = allfiles.get(i);
+                               var bn  = GLib.Path.get_basename(fn);
                                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)) {
+                                       
+                                       if (Regex.match_simple("\\~$", fn)) {
+                                               GLib.debug("SKIP %s - ~",fn);
+                                               continue;
+                                       }
+                                       if (Regex.match_simple("\\.stamp$", fn)) {
+                                               GLib.debug("SKIP %s - .o",fn);
                                                continue;
                                        }
-                                       if (Regex.match_simple("~$", fn)) {
+                                       if ("stamp-h1" == bn) {
+                                               GLib.debug("SKIP %s - .o",fn);
+                                               continue;
+                                       }
+                                       
+                                       // confgure.am
+                                       if ("config.h" == bn || "config.h.in" == bn || "config.log" == bn  || "configure" == bn ) {
+                                               if (allfiles.index_of( in_path +"/configure.ac") > -1) {
+                                                       continue;
+                                               }
+                                       }
+                                       // makefile
+                                       if ("Makefile" == bn || "Makefile.in" == bn ) {
+                                               if (allfiles.index_of( in_path +"/Makefile.am") > -1) {
+                                                       continue;
+                                               }
+                                       }
+                                       
+                                       if (Regex.match_simple("^\\.", bn)) {
+                                               GLib.debug("SKIP %s - hidden",fn);
                                                continue;
                                        }
                                        if (Regex.match_simple("\\.vala$", fn)) {
                                                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;
                                        }
@@ -294,8 +331,10 @@ namespace Project {
                                                
                                                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;
                                        }
@@ -305,10 +344,11 @@ 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) {
+                                       GLib.debug("Exception %s",e.message);
                                        continue;
                                }
                        }