Skip to content

Commit

Permalink
feat(darwin): Change folder structure (spicetify#1144)
Browse files Browse the repository at this point in the history
* feat(darwin): Change folder structure

* chore(install): Remove unnecessary stuff

* fix(install): Fix if statement
  • Loading branch information
rxri authored Oct 7, 2021
1 parent f7946d6 commit f7fa73b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
22 changes: 18 additions & 4 deletions install.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,21 @@ else
download_uri="https://github.com/khanhas/spicetify-cli/releases/download/v${1}/spicetify-${1}-${target}.tar.gz"
fi

spicetify_install="${SPICETIFY_INSTALL:-$HOME/spicetify-cli}"
spicetify_install="$HOME/spicetify-cli"

if [[ "$target" == *"darwin"* ]]; then
spicetify_install="$HOME/.spicetify"
rcFile="$HOME/.zshenv"

if ! grep -q "$spicetify_install" "$rcFile"; then
echo "export PATH=${spicetify_install}:$PATH" >> "$rcFile"
fi
fi

exe="$spicetify_install/spicetify"

if [ ! -d "$spicetify_install" ]; then
echo "MAKING FOLDER $spicetify_install";
echo "Creating $spicetify_install";
mkdir -p "$spicetify_install"
fi

Expand All @@ -51,12 +61,16 @@ rm "$tar_file"
echo ""
echo "spicetify was installed successfully to $exe"
echo ""
if command -v spicetify >/dev/null; then
if command -v spicetify > /dev/null; then
echo "Run 'spicetify --help' to get started"
elif [[ "$spicetify_install" == *".spicetify"* ]]; then
echo "Please restart your Terminal to have spicetify in your PATH."
echo "Then you can run:"
echo "'$exe --help' to get started"
else
echo "Manually add the directory to your \$HOME/.bash_profile (or similar)"
echo " export SPICETIFY_INSTALL=\"$spicetify_install\""
echo " export PATH=\"\$SPICETIFY_INSTALL:\$PATH\""
echo ""
echo "Run '$exe --help' to get started"
fi
fi
9 changes: 3 additions & 6 deletions src/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,10 @@ func getSpicetifyFolder() string {
result = filepath.Join(parent, "spicetify")

} else if runtime.GOOS == "darwin" {
parent, isAvailable := os.LookupEnv("XDG_CONFIG_HOME")
parent := filepath.Join(os.Getenv("HOME"), ".config")
utils.CheckExistAndCreate(parent)

if !isAvailable || len(parent) == 0 {
parent = os.Getenv("HOME")
}

result = filepath.Join(parent, "spicetify_data")
result = filepath.Join(parent, "spicetify")
}

return result
Expand Down

0 comments on commit f7fa73b

Please sign in to comment.