aboutsummaryrefslogtreecommitdiff
path: root/bin/menu-projects
diff options
context:
space:
mode:
authorSamuel Fadel <samuel@nihil.ws>2023-06-20 12:27:44 +0200
committerSamuel Fadel <samuel@nihil.ws>2023-06-20 12:28:40 +0200
commit5ec461479aac4433066292c668d316ad64a0efa9 (patch)
tree6ef0314f026399c5b71474ef6b45740d055bde91 /bin/menu-projects
parent82b86e0bc4f28684d654d5e691a0bc994810030d (diff)
Fix menu-projects to accept only existing diretories.
* bin/menu-projects: Check for non-existing directory
Diffstat (limited to 'bin/menu-projects')
-rwxr-xr-xbin/menu-projects8
1 files changed, 5 insertions, 3 deletions
diff --git a/bin/menu-projects b/bin/menu-projects
index 728e52a..6172bf2 100755
--- a/bin/menu-projects
+++ b/bin/menu-projects
@@ -5,13 +5,15 @@ project=$({ for p in $HOME/src/*/.git ;do
basename `dirname $p`
done } | bemenu -i -s -c -l 20 -W 0.5 -p 'Project:')
-if [ -z $project ]; then
- # Allows cancelling selection
+project_dir=$HOME/src/$project
+
+if [ -z $project ] || [ ! -d $project_dir ]; then
+ # Cancel selection or typo
exit 1
fi
# cd into the project directory to load manifests, if available, and start Emacs from there
-cd $HOME/src/$project
+cd $project_dir
if [ -f manifest.scm ]; then
guix shell -m manifest.scm -- emacs .
elif [ -f .manifest.scm ]; then