Skip to content

Commit 688047a

Browse files
committed
LPD-73748 lec.sh: more robust dir checking
1 parent b65c264 commit 688047a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

scripts/cli/lec.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,15 @@ _getRunningProjectDir() {
222222
_listRunningProjects | grep -e "/${project_locator}$" -e "${project_locator}"
223223
}
224224
_getProjectRoot() {
225-
local dir="${PWD}"
225+
local dir="${1}"
226+
227+
if [[ -z "${dir}" ]]; then
228+
return 1
229+
fi
230+
231+
if [[ -f "${dir}" ]]; then
232+
dir="${dir%/*}"
233+
fi
226234

227235
while [[ -d "${dir}" ]]; do
228236
if [[ -d "${dir}/compose-recipes" ]]; then

0 commit comments

Comments
 (0)