X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=File.js;h=21c8ef2cd78c9d62b7f18439451e0953c18d925f;hb=f927f87326fa8196765f0c524cb514a2152f66c3;hp=2726e0ebd5aea9feaaee9243ad3cbe543d9f6c8c;hpb=c23140335e832d6f30d6f29697bf6339639d5c65;p=app.Builder.js diff --git a/File.js b/File.js index 2726e0ebd..21c8ef2cd 100644 --- a/File.js +++ b/File.js @@ -32,7 +32,7 @@ var File = { return s; }, - trim : function (s,toTrim) { + trim : function (s,toTrim) { var out = s.ltrim(toTrim); out = out.rtrim(toTrim); return out; @@ -61,10 +61,25 @@ var File = { } return out; }, - + + dirname : function(s) + { + var ar = s.split(File.SEPARATOR); + ar.pop(); + return ar.join(File.SEPARATOR); + }, + basename : function(s) + { + var ar = s.split(File.SEPARATOR); + return ar.pop(); + }, + read : function (path) { var out = {}; GLib.file_get_contents(path, out, null, null); + + //print(JSON.(out)); + return out['value']; }, @@ -80,7 +95,7 @@ var File = { list : function (path) { var listing = []; - + print(path); var f = Gio.file_new_for_path(String(path)); var file_enum = f.enumerate_children(Gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME, Gio.FileQueryInfoFlags.NONE, null);