X-Git-Url: http://git.roojs.org/?p=gitlive;a=blobdiff_plain;f=File.js;h=6f4d03c12bb63f6e968740c293e12635d71a3b50;hp=2726e0ebd5aea9feaaee9243ad3cbe543d9f6c8c;hb=43b29bb4bbe76f64630ebfbdc6cc77aa61960058;hpb=25307f4312942d26e993117922652b798d8d59c9 diff --git a/File.js b/File.js index 2726e0eb..6f4d03c1 100644 --- a/File.js +++ b/File.js @@ -65,6 +65,7 @@ var File = { read : function (path) { var out = {}; GLib.file_get_contents(path, out, null, null); + return out['value']; }, @@ -93,8 +94,7 @@ var File = { file_enum.close(null); listing.sort(); - - return listing; + return listing; }, mtime : function (path) { @@ -113,8 +113,8 @@ var File = { * @returns {String} the resolved path path. * */ - realpath : function (path) { - return this.canonical(path); + realpath : function (path) { + return imports.os.realpath(path); }, canonical : function (path) { var f = Gio.file_new_for_path(String(path)); @@ -194,9 +194,16 @@ var File = { * FIXME - needs perms setting.. * * @arg directory {String} Directory to make + * @arg recursive {Boolean} */ - mkdir : function (destPath) { + mkdir : function (destPath, rec) { + //print("mkdir: " + destPath); + rec = rec || false; + if (rec && !File.isDirectory(GLib.path_get_dirname(destPath))) { + File.mkdir(GLib.path_get_dirname(destPath),true); + } + var dest = Gio.file_new_for_path(String(destPath)); return dest.make_directory(null); },