mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-09 13:15:37 +03:00
29 lines
999 B
Bash
Executable File
29 lines
999 B
Bash
Executable File
#!/bin/bash
|
|
# Get current path in Windows format
|
|
if command -v "cygpath" > /dev/null; then
|
|
# We have cygpath to do the conversion
|
|
ATOMCMD=$(cygpath "$(dirname "$0")/pulsar.cmd" -a -w)
|
|
ARGS=( $(cygpath -a -w "$@" | tr '\n' ' ') )
|
|
else
|
|
ARGS=$@
|
|
pushd "$(dirname "$0")" > /dev/null
|
|
if [[ $(uname -r) =~ (M|m)icrosoft ]]; then
|
|
# We are in Windows Subsystem for Linux, map /mnt/drive
|
|
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')"
|
|
ATOMCMD="$(echo $PWD | sed 's/\/mnt\/\([a-z]*\)\(.*\)/\1:\2/')/pulsar.cmd"
|
|
else
|
|
# We don't have cygpath or WSL so try pwd -W
|
|
ATOMCMD="$(pwd -W)/pulsar.cmd"
|
|
fi
|
|
popd > /dev/null
|
|
fi
|
|
|
|
if [ "$(uname -o)" == "Msys" ] || [[ $(uname -r) == *-Microsoft ]]; then
|
|
cmd.exe //C "$ATOMCMD" "$@" # Msys amd WSL think /C is a Windows path...
|
|
else
|
|
cmd.exe /C "$ATOMCMD" "${ARGS[@]}" # Cygwin does not
|
|
fi
|