aboutsummaryrefslogtreecommitdiffstats
path: root/erts/etc/win32/msys_tools/msys2win_path.sh
blob: 679a9d6a8fdff08c4c98a9e35e75e72b2b3c7b20 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#! /bin/bash
MIXED=false
ABSOLUTE=false
done=false
while [ $done = false ]; do
    case "$1" in
	-m) 
	    MIXED=true;
	    shift;;
	-a)
	    ABSOLUTE=true;
	    shift;;
	*)
	    done=true;;
    esac
done
if [ -z "$1" ]; then
    echo "Usage: $0 <path>" >&2
    exit 1;
fi
MSYS_PATH=`win2msys_path.sh "$1"` # Clean up spaces
if [ $ABSOLUTE = true ]; then
    MSYS_DIR=`dirname "$MSYS_PATH"`
    MSYS_FILE=`basename "$MSYS_PATH"`
    if [ X"$MSYS_FILE" = X".." ]; then
	MSYS_DIR="$MSYS_DIR/$MSYS_FILE"
	WIN_ADD=""
    else
	WIN_ADD="/$MSYS_FILE"
    fi
    SAVEDIR=`pwd`
    cd $MSYS_DIR
    CURRENT=`pwd`
    cd $SAVEDIR
    WINPATH=`cmd //C echo $CURRENT`
    WINPATH="$WINPATH$WIN_ADD"
else
    WINPATH=`cmd //c echo $MSYS_PATH`
fi
if [ $MIXED = true ]; then
    echo $WINPATH
else
    echo $WINPATH | sed 's,/,\\,g'
fi