Skip to content

Commit

Permalink
fix(#6): fix bug cannot run in macos due to symlink and wrong keybind…
Browse files Browse the repository at this point in the history
…ing path (#9)
  • Loading branch information
linhx authored Jan 8, 2024
1 parent 77d1df4 commit d7fd03e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions install
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ if [ -f "$FILE_ZSHRC" ]; then
ZSH_SCRIPT_KEYBINDING="$APP_DIR/shell/key-bindings.zsh"
RC_FILE="$DATA_DIR/.zsh"
tee $RC_FILE > /dev/null <<EOT
if [ -f '$BASH_SCRIPT_KEYBINDING' ]; then
. '$BASH_SCRIPT_KEYBINDING'
if [ -f '$ZSH_SCRIPT_KEYBINDING' ]; then
. '$ZSH_SCRIPT_KEYBINDING'
fi
EOT
SOURCE_STR="[ -f $RC_FILE ] && source $RC_FILE"
Expand Down
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ func getAppDir() string {
if err != nil {
panic(fmt.Errorf("Cannot get executable: %w", err))
}
return filepath.Dir(path);
realPath, err := filepath.EvalSymlinks(path)
if err != nil {
panic(fmt.Errorf("Cannot get real path from symlink: %w", err))
}
return filepath.Dir(realPath);
}

func main() {
Expand Down

0 comments on commit d7fd03e

Please sign in to comment.