Skip to content

Commit

Permalink
some updates for the Wakanda adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
AMorgaut committed Oct 19, 2011
1 parent a87887d commit 2af8a9b
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions lib/pinf-loader-js/adapter/wakanda.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ exports.init = function(api)

api.FILE.exists = function(filename)
{
return File(filename).exists;
return File(filename).exists || Folder(filename).exists;
}

api.FILE.isFile = function( v)
{
// TODO: Need `new File(filename).isFile`
return File(filename).exists;
return File(filename).isFile();
// throw new Error("NYI - FILE.isFile");
}

Expand All @@ -90,15 +90,29 @@ exports.init = function(api)

api.FILE.mkdirs = function(filename)
{
throw new Error("NYI - FILE.mkdirs");
// @see http://doc.wakanda.org/Files-and-Folders/Folder-Class/create.301-677914.en.html
return Folder(filename).create();
}

api.FILE.write = function(filename, data, encoding)
{
throw new Error("NYI - FILE.write");
// @see http://doc.wakanda.org/Global-Application/Application/saveText.301-664836.en.html#
var charsets, charset;
charsets = {
"utf-8": 7
};

charset = charsets[encoding];
if (charset === undefined) {
throw new Error("NYI - FILE.write with charset different to utf-8");
}
application.saveText(data, filename, charset);
}

api.FILE.rename = function(from, to)
{
// @see http://doc.wakanda.org/Files-and-Folders/File-Class/setName.301-677039.en.html
// File(from).setName(to);
throw new Error("NYI - FILE.rename");
}

Expand Down

0 comments on commit 2af8a9b

Please sign in to comment.