Skip to content
This repository

some updates for wakanda support #4

Open
wants to merge 1 commit into from

2 participants

Alexandre Morgaut Christoph Dorn
Alexandre Morgaut

No description provided.

Christoph Dorn
Owner

Have these changes been tested yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Oct 19, 2011
Alexandre Morgaut some updates for the Wakanda adapter 2af8a9b
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 18 additions and 4 deletions. Show diff stats Hide diff stats

  1. 22  lib/pinf-loader-js/adapter/wakanda.js
22  lib/pinf-loader-js/adapter/wakanda.js
@@ -72,13 +72,13 @@ exports.init = function(api)
72 72
 
73 73
     api.FILE.exists = function(filename)
74 74
     {
75  
-        return File(filename).exists;
  75
+        return File(filename).exists || Folder(filename).exists;
76 76
     }
77 77
 
78 78
     api.FILE.isFile = function( v)
79 79
     {
80 80
     	// TODO: Need `new File(filename).isFile`
81  
-        return File(filename).exists;
  81
+        return File(filename).isFile();
82 82
 //        throw new Error("NYI - FILE.isFile");
83 83
     }
84 84
 
@@ -90,15 +90,29 @@ exports.init = function(api)
90 90
 
91 91
     api.FILE.mkdirs = function(filename)
92 92
     {
93  
-        throw new Error("NYI - FILE.mkdirs");
  93
+        // @see http://doc.wakanda.org/Files-and-Folders/Folder-Class/create.301-677914.en.html
  94
+        return Folder(filename).create();
94 95
     }
95 96
     
96 97
     api.FILE.write = function(filename, data, encoding)
97 98
     {
98  
-        throw new Error("NYI - FILE.write");
  99
+        // @see http://doc.wakanda.org/Global-Application/Application/saveText.301-664836.en.html#
  100
+        var charsets, charset;
  101
+        charsets = {
  102
+            "utf-8": 7
  103
+        };
  104
+        
  105
+        charset = charsets[encoding];
  106
+        if (charset === undefined) {
  107
+            throw new Error("NYI - FILE.write with charset different to utf-8");
  108
+        }
  109
+        application.saveText(data, filename, charset);
99 110
     }
  111
+    
100 112
     api.FILE.rename = function(from, to)
101 113
     {
  114
+        // @see http://doc.wakanda.org/Files-and-Folders/File-Class/setName.301-677039.en.html
  115
+        // File(from).setName(to);
102 116
         throw new Error("NYI - FILE.rename");
103 117
     }
104 118
 
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.