Skip to content
This repository
Browse code

fixes to work properly with ringo

  • Loading branch information...
commit 4165586432a3ea5c78eaad506339acf59595132e 1 parent 8972285
Kris Zyp authored October 14, 2011
15  engines/rhino/fs.js
... ...
@@ -1,4 +1,4 @@
1  
-var File = require("file"),
  1
+var File = require("fs"),
2 2
 	LazyArray = require("../../lazy-array").LazyArray,
3 3
     defer = require("../../promise").defer;
4 4
 for(var i in File){
@@ -10,8 +10,15 @@ exports.writeFileSync = File.write;
10 10
 exports.mkdirSync = File.mkdir;
11 11
 exports.readdir = exports.list;
12 12
 exports.stat = exports.statSync = function(path) {
13  
-	try{
14  
-	    var stat = File.stat.apply(null, arguments);
  13
+	return {
  14
+		isFile: function(){
  15
+			return File.isFile(path);
  16
+		},
  17
+		size: File.size(path)
  18
+	};
  19
+	
  20
+	/*try{
  21
+	   var stat = File.stat.apply(null, arguments);
15 22
 	}catch(e){
16 23
     	var deferred = defer();
17 24
     	deferred.reject(e);
@@ -25,7 +32,7 @@ exports.stat = exports.statSync = function(path) {
25 32
     	deferred.reject("File not found");
26 33
     	return deferred.promise;
27 34
     }
28  
-    return stat;
  35
+    return stat;*/
29 36
 }
30 37
 
31 38
 exports.makeTree = File.mkdirs;
2  fs.js
@@ -2,7 +2,7 @@
2 2
 * Node fs module that returns promises
3 3
 */
4 4
 
5  
-if (typeof system === "object" && system.engine === "rhino"){
  5
+if (typeof java === "object"){
6 6
 	var fs = require("./engines/rhino/fs");
7 7
 	
8 8
 	// for rhino
8  lazy-array.js
... ...
@@ -1,4 +1,4 @@
1  
-({define:typeof define!="undefined"?define:function(deps, factory){module.exports = factory.apply(this, deps.map(require))}}).
  1
+({define:typeof define!="undefined"?define:function(deps, factory){module.exports = factory.apply(this, deps.map(function(id){require(id)}))}}).
2 2
 define(["./promise"], function(promise){
3 3
 try{
4 4
 	var when = promise.when;
@@ -32,10 +32,10 @@ exports.get = function(array, index){
32 32
 	});
33 33
 };
34 34
 
35  
-
36 35
 var testProto = {};
37  
-var testProto2 = testProto.__proto__ = testProto2; 
38  
-var mutableProto = testProto.__proto__ === testProto2;
  36
+var testProto2 = {a:"b"};
  37
+testProto.__proto__ = testProto2; 
  38
+var mutableProto = testProto.a == "b";
39 39
 function SomeWrapper(hasSomeAndLength){
40 40
 	if(mutableProto){
41 41
 		hasSomeAndLength.source = hasSomeAndLength;
8  process.js
@@ -23,8 +23,12 @@ if(typeof process !== "undefined"){
23 23
 	}
24 24
 }
25 25
 else if(typeof navigator === "undefined"){
26  
-	exports.args = require("" + "system").args;
27  
-	exports.env = require("" + "system").env;
  26
+	try{
  27
+		exports.args = require("" + "system").args;
  28
+		exports.env = require("" + "system").env;
  29
+	}catch(e){
  30
+		// in raw rhino, we don't even have system
  31
+	}
28 32
 	exports.print = print;
29 33
 }
30 34
 });

0 notes on commit 4165586

Please sign in to comment.
Something went wrong with that request. Please try again.