+
+
+ public static Array<GitRepo> list()
+ {
+
+ //if (GitRepo.list_cache != null) {
+ // unowned Array<GitRepo> ret = GitRepo.list_cache;
+ // return ret;
+ //}
+
+ var list_cache = new Array<GitRepo>();
+
+ var dir = Environment.get_home_dir() + "/gitlive";
+
+ var f = File.new_for_path(dir);
+ FileEnumerator file_enum;
+ try {
+ file_enum = f.enumerate_children(
+ FileAttribute.STANDARD_DISPLAY_NAME + ","+
+ FileAttribute.STANDARD_TYPE,
+ FileQueryInfoFlags.NONE,
+ null);
+ } catch (Error e) {
+
+ return list_cache;
+
+ }
+
+ FileInfo next_file;
+
+ while (true) {
+
+ try {
+ next_file = file_enum.next_file(null);
+ if (next_file == null) {
+ break;
+ }
+
+ } catch (Error e) {
+ GLib.debug("Error: %s",e.message);
+ break;
+ }
+
+ //print("got a file " + next_file.sudo () + '?=' + Gio.FileType.DIRECTORY);
+
+ if (next_file.get_file_type() != FileType.DIRECTORY) {
+ next_file = null;
+ continue;
+ }
+
+ if (next_file.get_file_type() == FileType.SYMBOLIC_LINK) {
+ next_file = null;
+ continue;
+ }
+
+ if (next_file.get_display_name()[0] == '.') {
+ next_file = null;
+ continue;
+ }
+ var sp = dir+"/"+next_file.get_display_name();
+
+ var gitdir = dir + "/" + next_file.get_display_name() + "/.git";
+
+ if (!FileUtils.test(gitdir, FileTest.IS_DIR)) {
+ continue;
+ }
+
+ list_cache.append_val(new GitRepo( sp )) ;
+
+
+ }
+
+ return list_cache;
+
+
+
+}
+
+