2
0
Эх сурвалжийг харах

Fob on Windows: deal with absolute paths

Arthur Yefimov 3 жил өмнө
parent
commit
52e787d7c8

+ 12 - 4
Data/bin/compile.bat

@@ -15,12 +15,20 @@ SET DIR=%~dp0
 
 
 SET FNAME=%1
 SET FNAME=%1
 
 
-IF "%FNAME:~0,1%"=="\" GOTO ENDIF1
-  SET FNAME=..\%FNAME%
+REM If "C:Dir\Dir2"-style relative path given
+IF NOT "%FNAME:~1,1%"==":" GOTO ENDIF1
+IF "%FNAME:~2,1%"=="\" GOTO ENDIF1
+  SET FNAME=%FNAME:~0,2%..\%FNAME:~2%
+  GOTO ENDIF2
 :ENDIF1
 :ENDIF1
+REM Else if not "\" or "C:\"-style absolute path
+IF "%FNAME:~0,1%"=="\" GOTO ENDIF2
+IF "%FNAME:~1,2%"==":\" GOTO ENDIF2
+  SET FNAME=..\%FNAME%
+:ENDIF2
 
 
 IF NOT EXIST _Build MD _Build
 IF NOT EXIST _Build MD _Build
-CD _Build
+CD _Build || EXIT /b 407
 
 
 SET OFRDIR=%DIR%OfrontPlus\Target\Win32
 SET OFRDIR=%DIR%OfrontPlus\Target\Win32
 SET PATH=%OFRDIR%;%PATH%
 SET PATH=%OFRDIR%;%PATH%
@@ -31,5 +39,5 @@ ECHO ON
 @%OFR% %2 %FNAME%
 @%OFR% %2 %FNAME%
 @SET RETCODE=%ERRORLEVEL%
 @SET RETCODE=%ERRORLEVEL%
 @ECHO OFF
 @ECHO OFF
-@CD ..
+CD ..
 EXIT /b %RETCODE%
 EXIT /b %RETCODE%

+ 15 - 5
Data/bin/compile.sh

@@ -1,10 +1,10 @@
 #!/bin/bash
 #!/bin/bash
-#   This script is automatically run by Free Oberon on Linux
-#   for each compiled module. The initial current directory of
-#   the script is where FreeOberon executable is located.
-#   You are free to edit this file to adjust the process.
+### This script is automatically run by Free Oberon on Linux
+### for each compiled module. The initial current directory of
+### the script is where FreeOberon executable is located.
+### You are free to edit this file to adjust the process.
 
 
-#   Set DIR = directory of this script
+### Set DIR = directory of this script
 SOURCE=${BASH_SOURCE[0]}
 SOURCE=${BASH_SOURCE[0]}
 while [ -h "$SOURCE" ]; do
 while [ -h "$SOURCE" ]; do
   DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
   DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
@@ -15,6 +15,14 @@ DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
 
 
 FNAME=$1
 FNAME=$1
 
 
+
+
+
+
+
+
+
+
 if [[ "${FNAME:0:1}" != "/" ]]; then
 if [[ "${FNAME:0:1}" != "/" ]]; then
   FNAME=../$FNAME
   FNAME=../$FNAME
 fi
 fi
@@ -27,7 +35,9 @@ PATH="$OFRDIR:$PATH"
 export OBERON=".:$DIR/../../src:$OFRDIR/Lib/Sym"
 export OBERON=".:$DIR/../../src:$OFRDIR/Lib/Sym"
 OFR="ofront+ -s -88 -7w"
 OFR="ofront+ -s -88 -7w"
 
 
+
 $OFR $2 $FNAME
 $OFR $2 $FNAME
 retcode=$?
 retcode=$?
+
 cd ..
 cd ..
 exit $retcode
 exit $retcode

+ 4 - 4
Data/bin/link_console.sh

@@ -1,8 +1,8 @@
 #!/bin/bash
 #!/bin/bash
-#   This script is run by Free Oberon on Linux
-#   to link a console program.
-#   When it is being run, the current directory
-#   must be the root directory of Free Oberon.
+### This script is run by Free Oberon on Linux
+### to link a console program.
+### When it is being run, the current directory
+### must be the root directory of Free Oberon.
 
 
 # Set DIR = directory of this script
 # Set DIR = directory of this script
 SOURCE=${BASH_SOURCE[0]}
 SOURCE=${BASH_SOURCE[0]}

+ 4 - 4
Data/bin/link_graph.sh

@@ -1,8 +1,8 @@
 #!/bin/bash
 #!/bin/bash
-#   This script is run by Free Oberon on Linux
-#   to link a graphics program.
-#   When it is being run, the current directory
-#   must be the root directory of Free Oberon.
+### This script is run by Free Oberon on Linux
+### to link a graphics program.
+### When it is being run, the current directory
+### must be the root directory of Free Oberon.
 
 
 # Set DIR = directory of this script
 # Set DIR = directory of this script
 SOURCE=${BASH_SOURCE[0]}
 SOURCE=${BASH_SOURCE[0]}