| 
     
      
      
      From: <ha...@us...> - 2007-10-04 00:48:46
      
     
   | 
Revision: 1777
          http://cogkit.svn.sourceforge.net/cogkit/?rev=1777&view=rev
Author:   hategan
Date:     2007-10-03 17:48:45 -0700 (Wed, 03 Oct 2007)
Log Message:
-----------
cwd stuff
Modified Paths:
--------------
    trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/FileWrite.java
    trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/functions/Misc.java
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/FileWrite.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/FileWrite.java	2007-10-04 00:47:48 UTC (rev 1776)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/FileWrite.java	2007-10-04 00:48:45 UTC (rev 1777)
@@ -35,8 +35,7 @@
 	}
 
 	protected void partialArgumentsEvaluated(VariableStack stack) throws ExecutionException {
-		String fileName = TypeUtil.toString(A_NAME.getValue(stack));
-		File file = new File(fileName);
+		File file = TypeUtil.toFile(stack, A_NAME);
 		try {
 			final BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(file,
 					TypeUtil.toBoolean(A_APPEND.getValue(stack))));
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/functions/Misc.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/functions/Misc.java	2007-10-04 00:47:48 UTC (rev 1776)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/workflow/nodes/functions/Misc.java	2007-10-04 00:48:45 UTC (rev 1777)
@@ -57,9 +57,9 @@
 	}
 
 	public boolean sys_contains(VariableStack stack) throws ExecutionException {
-		String file = TypeUtil.toString(PA_FILE.getValue(stack));
+		File f = TypeUtil.toFile(stack, PA_FILE);
 		try {
-			BufferedReader br = new BufferedReader(new FileReader(file));
+			BufferedReader br = new BufferedReader(new FileReader(f));
 			String line = null;
 			String expanded = TypeUtil.toString(PA_VALUE.getValue(stack));
 			do {
@@ -70,7 +70,7 @@
 			} while (line != null);
 		}
 		catch (Exception e) {
-			throw new ExecutionException("Error reading file " + file, e);
+			throw new ExecutionException("Error reading file " + f, e);
 		}
 		return false;
 	}
@@ -112,10 +112,7 @@
 
 	public Object sys_readfile(VariableStack stack) throws ExecutionException {
 		try {
-			File f = new File(TypeUtil.toString(PA_FILE.getValue(stack)));
-			if (!f.isAbsolute()) {
-				f = new File(stack.getExecutionContext().getCwd() + File.separator + f.getPath());
-			}
+			File f = TypeUtil.toFile(stack, PA_FILE);
 			BufferedReader br = new BufferedReader(new FileReader(f));
 			StringBuffer text = new StringBuffer();
 			String line = br.readLine();
@@ -139,9 +136,9 @@
 	}
 
 	public Object sys_file_readline(VariableStack stack) throws ExecutionException {
+		File f = TypeUtil.toFile(stack, PA_FILE);
 		try {
-			RandomAccessFile file = new RandomAccessFile(new File(
-					TypeUtil.toString(PA_FILE.getValue(stack))), "r");
+			RandomAccessFile file = new RandomAccessFile(f, "r");
 			try {
 				file.seek(TypeUtil.toNumber(PA_OFFSET.getValue(stack)).longValue());
 				return file.readLine();
@@ -219,9 +216,9 @@
 	public Object sys_outputstream(VariableStack stack) throws ExecutionException {
 		String type = TypeUtil.toString(PA_TYPE.getValue(stack, null));
 		if ("file".equalsIgnoreCase(type) || PA_FILE.isPresent(stack)) {
-			String file = TypeUtil.toString(PA_FILE.getValue(stack));
+			File f = TypeUtil.toFile(stack, PA_FILE);
 			try {
-				return new PrintStream(new FileOutputStream(new File(file)));
+				return new PrintStream(new FileOutputStream(f));
 			}
 			catch (Exception e) {
 				throw new ExecutionException("Could not open file", e);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |