aboutsummaryrefslogblamecommitdiffstats
path: root/erts/etc/win32/msys_tools/msys2win_path.sh
blob: 679a9d6a8fdff08c4c98a9e35e75e72b2b3c7b20 (plain) (tree)











































                                                    
#! /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