[m-rev.] for review: shell script for C# grade uses absolute path

Sebastian Godelet sebastian.godelet+github at gmail.com
Sun Mar 16 01:38:57 AEDT 2014


For review by anyone.

The generated shell script to launch C# executables does not use
absolute pathes, this patch fixes that (now works the same as the Java
grade).

compiler/compile_target_code.m:
    Assigning script directory to DIR and use that to launch the CLI
interpreter.

Sebastian.

---
 compiler/compile_target_code.m | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/compiler/compile_target_code.m b/compiler/compile_target_code.m
index 1893393..cdf510e 100644
--- a/compiler/compile_target_code.m
+++ b/compiler/compile_target_code.m
@@ -3014,10 +3014,11 @@ write_cli_shell_script(Globals, ExeFileName,
Stream, !IO) :-
         ":", LinkLibraryDirectories),
     list.foldl(io.write_string(Stream), [
         "#!/bin/sh\n",
+        "DIR=${0%/*}\n",
         "MONO_PATH=$MONO_PATH:", LinkLibraryDirectories, "\n",
         "export MONO_PATH\n",
         "CLI_INTERPRETER=${CLI_INTERPRETER:-", CLI, "}\n",
-        "exec $CLI_INTERPRETER ", ExeFileName, " \"$@\"\n"
+        "exec $CLI_INTERPRETER $DIR/", ExeFileName, " \"$@\"\n"
     ], !IO).

 :- pred create_java_archive(globals::in, io.output_stream::in, file_name::in,
-- 
1.8.3.2



More information about the reviews mailing list