Merge pull request #4349 from FishingCactus/fix-atom_plugin_for_cygwin
Fixed atom plugin for cygwin users
Diff
1diff --git a/plugins/atom/atom.plugin.zsh b/plugins/atom/atom.plugin.zsh
2index ec1a114edeb67221e0f203646fb0daf30fabbe07..2711cf0e8967276380d0441e43cbf112af9cea56 100644
3--- a/plugins/atom/atom.plugin.zsh
4+++ b/plugins/atom/atom.plugin.zsh
5@@ -1,8 +1,5 @@
6-# Gets OS Type
7-unamestr=$(uname -s)
8-
9-# If OSX
10-if [[ "$unamestr" == 'Darwin' ]]; then
11+case $OSTYPE in
12+darwin*)
13 local _atom_paths > /dev/null 2>&1
14 _atom_paths=(
15 "$HOME/Applications/Atom.app"
16@@ -15,8 +12,26 @@ if [[ "$unamestr" == 'Darwin' ]]; then
17 break
18 fi
19 done
20-# If Linux
21-elif [[ "$unamestr" == 'Linux' ]]; then
22+ ;;
23+cygwin)
24+ local _atom_path > /dev/null 2>&1
25+
26+ _atom_path=${LOCALAPPDATA}/atom/bin/atom
27+
28+ if [[ -a $_atom_path ]]; then
29+ cyg_open_atom()
30+ {
31+ if [[ -n $1 ]]; then
32+ ${_atom_path} `cygpath -w -a $1`
33+ else
34+ ${_atom_path}
35+ fi
36+ }
37+
38+ alias at=cyg_open_atom
39+ fi
40+ ;;
41+linux*)
42 # Alerts the user if 'atom' is not a found command.
43 type atom >/dev/null 2>&1 && alias at="atom" || { echo >&2 "You have enabled the atom oh-my-zsh plugin on Linux, but atom is not a recognized command. Please make sure you have it installed before using this plugin."; }
44-fi
45+esac