var fn = this.firstPath() + "/config1.builder";
- print("load: " + fn );
+ GLib.debug("load: " + fn );
if (!FileUtils.test(fn, FileTest.EXISTS)) {
this.compilegroups.set("_default_", new GtkValaSettings("_default_") );
}
this.compilegroups.set(vs.name,vs);
}
- print("%s\n",this.configToString ());
+ GLib.debug("%s\n",this.configToString ());
}
public string configToString()
public void writeConfig()
{
var fn = this.firstPath() + "/config1.builder";
- print("write: " + fn );
+ GLib.debug("write: " + fn );
var f = GLib.File.new_for_path(fn);
data_out.close(null);
return ;
-
-
-
+
+ }
+ /**
+ * perhaps we should select the default in the window somewhere...
+ */
+ public string firstBuildModule()
+ {
+ var iter = this.compilegroups.map_iterator();
+ while(iter.next()) {
+
+ if (iter.get_value().name == "__default__") {
+ continue;
+ }
+
+ return iter.get_value().name;
+ }
+ return "";
}
+
+
public string relPath(string target)
{
var basename = this.firstPath();
// eg. base = /home/xxx/fred/blogs
// target = /home/xxx/fred/jones
+
+ // this does not work correctly...
var bb = basename;
var prefix = "";
while (true) {
if ( bb.length < target.length &&
target.substring(0, bb.length) == bb) {
+
return prefix + target.substring(bb.length +1);
}
if (bb.length < 1) {
}
}
+ /**
+ * get a list of files for a folder..
+ *
+ * - in the project manager this has to list all possible compilable
+ * files - eg. exclue XXX.vala.c or XXX.c with the same name as
+ * a vala file (so to ignore the generated files)
+ *
+ * - for the editor navigation - this should exclude all files that
+ * are vala based on a bjs file..
+ *
+ */
+
+ public Gee.ArrayList<string> filesAll(string in_path)
+ {
+ var ret = new Gee.ArrayList<string>();
+
+ var dirname = this.resolve_path(
+ this.resolve_path_combine_path(this.firstPath(),in_path));
+
+ GLib.debug("SCAN %s\n", dirname);
+ // scan the directory for files -- ending with vala || c
+
+
+ var dir = File.new_for_path(dirname);
+ if (!dir.query_exists()) {
+ GLib.debug("SCAN %s - skip - does not exist\n", dirname);
+ return ret;
+ }
+
+
+ try {
+ var file_enum = dir.enumerate_children(
+ GLib.FileAttribute.STANDARD_DISPLAY_NAME,
+ GLib.FileQueryInfoFlags.NONE,
+ null
+ );
+
+
+ FileInfo next_file;
+ 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);
+
+ ret.add(in_path + "/" + fn);
+
+ // any other valid types???
+
+ }
+
+ } catch(Error e) {
+ GLib.warning("oops - something went wrong scanning the projects\n");
+ }
+
+ return ret;
+ }
+
+ public Gee.ArrayList<string> filesForCompile(string in_path)
+ {
+ var allfile = this.fileAll();
+ var ret = new Gee.ArrayList<string>();
+
+
+ for (var i = 0; i < cfiles.size; i ++) {
+ var fn = cfiles.get(i);
+ if (Regex.match_simple("\\.vala$", fn)) {
+ ret.add( fn);
+ continue;
+ }
+ // vala.c -- ignore..
+ if (Regex.match_simple("\\.vala\\.c$", fn)) {
+ continue;
+ }
+ // not a c file...
+ if (!Regex.match_simple("\\.c$", fn)) {
+ continue;
+ }
+
+ // is the c file the same as a vala file...
+
+ var vv = fn;
+ try {
+ vv = (new Regex("\\.c$")).replace( fn, fn, 0, ".vala");
+ } catch (Error e) {
+ continue;
+ }
+
+
+ if (ret.index_of( vv) > -1) {
+ continue;
+ }
+ // add the 'c' file..
+ ret.add(fn);
+ }
+ // sort.
+
+
+ }
+
+
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));
+
+ GLib.debug("SCAN %s\n", dirname);
// scan the directory for files -- ending with vala || c
var dir = File.new_for_path(dirname);
if (!dir.query_exists()) {
+ GLib.debug("SCAN %s - skip - does not exist\n", dirname);
return ret;
}
try {
var file_enum = dir.enumerate_children(
- GLib.FileAttribute.STANDARD_DISPLAY_NAME,
+ GLib.FileAttribute.STANDARD_DISPLAY_NAME,
GLib.FileQueryInfoFlags.NONE,
null
);
FileInfo next_file;
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 (Regex.match_simple("\\.vala$", fn)) {
- ret.add(dirname + "/" + fn);
+ ret.add(in_path + "/" + fn);
continue;
}
-
-
+ if (Regex.match_simple("\\.vala\\.c$", fn)) {
+ continue;
+ }
if (Regex.match_simple("\\.c$", fn)) {
// 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");
- ret.add(dirname + "/" + fn);
+ cfiles.add(in_path + "/" + fn);
continue;
}
// any other valid types???
- }
- } catch(Error e) {
- print("oops - something went wrong scanning the projects\n");
+ }
+
+ } catch(Error e) {
+ GLib.warning("oops - something went wrong scanning the projects\n");
+ }
+
+
+ // add the cfiles to ret - if they do not have a vala...
+ for (var i = 0; i < cfiles.size; i ++) {
+
+ var fn = cfiles.get(i);
+ vv = fn;
+ try {
+ vv = (new Regex("\\.c$")).replace( fn, fn, 0, ".vala");
+ } catch (Error e) {
+ continue;
+ }
+
+
+ if (ret.index_of( vv) > -1) {
+ continue;
+ }
+ ret.add(fn);
}
-
+
+
+ GLib.debug("SCAN %s = returning %d", dirname, ret.size);
return ret;
{
ret += "/";
}
+ //print("combined path = %s", ret + second);
return ret + second;
}
public string resolve_path_times(string part, int times, string? clue = null)
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.firstPath(), sources.get(i));
+
+ if (Path.get_basename (path) == "vapi") {
+ GLib.debug("Adding VAPIDIR: %s\n", path);
+ ret += path;
+ }
+
+ }
+ return ret;
+
+ }
}
this.packages = this.readArray(el.get_array_member("packages"));
}
+
+
+
public Gee.ArrayList<string> readArray(Json.Array ar)
{
var ret = new Gee.ArrayList<string>();