2016-05-24 21:14:24 +03:00
|
|
|
#!/bin/bash
|
|
|
|
# Get current path in Windows format
|
2016-05-16 07:02:47 +03:00
|
|
|
if command -v "cygpath" > /dev/null; then
|
2016-05-24 21:14:24 +03:00
|
|
|
# We have cygpath to do the conversion
|
2022-08-17 00:47:50 +03:00
|
|
|
ATOMCMD=$(cygpath "$(dirname "$0")/pulsar.cmd" -a -w)
|
|
|
|
ARGS=( $(cygpath -a -w "$@" | tr '\n' ' ') )
|
2016-05-16 07:02:47 +03:00
|
|
|
else
|
2018-04-10 08:24:53 +03:00
|
|
|
ARGS=$@
|
2016-05-16 23:01:10 +03:00
|
|
|
pushd "$(dirname "$0")" > /dev/null
|
2020-10-14 13:07:46 +03:00
|
|
|
if [[ $(uname -r) =~ (M|m)icrosoft ]]; then
|
2017-04-20 09:04:23 +03:00
|
|
|
# We are in Windows Subsystem for Linux, map /mnt/drive
|
2018-08-07 05:32:06 +03:00
|
|
|
root="/mnt/"
|
|
|
|
# If different root mount point defined in /etc/wsl.conf, use that instead
|
|
|
|
eval $(grep "^root" /etc/wsl.conf | sed -e "s/ //g")
|
|
|
|
root="$(echo $root | sed 's|/|\\/|g')"
|
2022-08-17 00:47:50 +03:00
|
|
|
ATOMCMD="$(echo $PWD | sed 's/\/mnt\/\([a-z]*\)\(.*\)/\1:\2/')/pulsar.cmd"
|
2017-04-20 09:04:23 +03:00
|
|
|
else
|
|
|
|
# We don't have cygpath or WSL so try pwd -W
|
2022-08-17 00:47:50 +03:00
|
|
|
ATOMCMD="$(pwd -W)/pulsar.cmd"
|
2017-04-20 09:04:23 +03:00
|
|
|
fi
|
2016-05-16 23:01:10 +03:00
|
|
|
popd > /dev/null
|
2016-05-16 07:02:47 +03:00
|
|
|
fi
|
2021-09-03 09:35:37 +03:00
|
|
|
|
2019-01-16 01:55:56 +03:00
|
|
|
if [ "$(uname -o)" == "Msys" ] || [[ $(uname -r) == *-Microsoft ]]; then
|
|
|
|
cmd.exe //C "$ATOMCMD" "$@" # Msys amd WSL think /C is a Windows path...
|
2016-05-24 21:14:24 +03:00
|
|
|
else
|
2018-04-10 08:24:53 +03:00
|
|
|
cmd.exe /C "$ATOMCMD" "${ARGS[@]}" # Cygwin does not
|
2016-05-24 21:14:24 +03:00
|
|
|
fi
|