aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorgit-bruh <prathamIN@proton.me>2024-04-08 00:43:44 +0530
committerFlorian Fischer <florian.fischer@muhq.space>2025-01-09 20:08:06 +0100
commit386ccd3213adc34ab9e56bb1b99160672771f064 (patch)
tree6dae4c11356f77ac10acc421d1038b37482874e3 /tools
parentf486814e083431d6170fc644338e19220f7f81d5 (diff)
downloadvis-lspc-386ccd3213adc34ab9e56bb1b99160672771f064.tar.gz
vis-lspc-386ccd3213adc34ab9e56bb1b99160672771f064.zip
*: pass rootUri
Diffstat (limited to 'tools')
-rwxr-xr-xtools/find-root26
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/find-root b/tools/find-root
new file mode 100755
index 0000000..d2c71ab
--- /dev/null
+++ b/tools/find-root
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+set -eu
+
+if [ ! "${1:-}" ]; then
+ exit 1
+fi
+
+BASEDIR="$(dirname "$1")"
+
+while read -r glob; do
+ cd "$BASEDIR"
+
+ while [ "$PWD" != "/" ]; do
+ set -- $glob
+
+ if [ -e "$1" ]; then
+ echo "$PWD"
+ exit 0
+ fi
+
+ cd ..
+ done
+done
+
+echo "$BASEDIR"