From 0ccb0f101037354874e42ed0bd408638c7367541 Mon Sep 17 00:00:00 2001 From: hns Date: Tue, 13 Jun 2006 10:46:50 +0000 Subject: [PATCH] * Convert file names to absolute paths in serialize()/deserialize() to avoid names being interpreted relative to root on Mac OS X. --- src/helma/scripting/rhino/GlobalObject.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/helma/scripting/rhino/GlobalObject.java b/src/helma/scripting/rhino/GlobalObject.java index ca6fd234..b239ac75 100644 --- a/src/helma/scripting/rhino/GlobalObject.java +++ b/src/helma/scripting/rhino/GlobalObject.java @@ -653,8 +653,8 @@ public class GlobalObject extends ImporterTopLevel implements PropertyRecorder { "the serialization to"); } Object obj = args[0]; - String filename = Context.toString(args[1]); - FileOutputStream fos = new FileOutputStream(filename); + File file = new File(Context.toString(args[1])).getAbsoluteFile(); + FileOutputStream fos = new FileOutputStream(file); Scriptable scope = ScriptableObject.getTopLevelScope(thisObj).getPrototype(); // use a ScriptableOutputStream that unwraps Wrappers ScriptableOutputStream out = new ScriptableOutputStream(fos, scope) { @@ -679,8 +679,8 @@ public class GlobalObject extends ImporterTopLevel implements PropertyRecorder { throw Context.reportRuntimeError( "Expected a filename to read the serialization from"); } - String filename = Context.toString(args[0]); - FileInputStream fis = new FileInputStream(filename); + File file = new File(Context.toString(args[0])).getAbsoluteFile(); + FileInputStream fis = new FileInputStream(file); Scriptable scope = ScriptableObject.getTopLevelScope(thisObj).getPrototype(); ObjectInputStream in = new ScriptableInputStream(fis, scope); Object deserialized = in.readObject();