File tree Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change 77
88import jinja2
99import yaml
10-
1110from ctf import ENV
1211from ctf .logger import LOG
1312
@@ -225,15 +224,12 @@ def find_ctf_root_directory() -> str:
225224 if "CTF_ROOT_DIR" in ENV
226225 else os .path .join (os .getcwd (), "." )
227226 )
227+ if not is_ctf_dir (path = path ):
228+ while path != (path := os .path .dirname (p = path )):
229+ ctf_dir = is_ctf_dir (path )
228230
229- while path != (path := os .path .dirname (p = path )):
230- dir = os .listdir (path = path )
231-
232- if ".deploy" not in dir :
233- continue
234- if "challenges" not in dir :
235- continue
236- break
231+ if ctf_dir :
232+ break
237233
238234 if path == "/" :
239235 LOG .critical (
@@ -246,6 +242,16 @@ def find_ctf_root_directory() -> str:
246242 return (__CTF_ROOT_DIRECTORY := path )
247243
248244
245+ def is_ctf_dir (path ):
246+ ctf_dir = True
247+ dir = os .listdir (path = path )
248+ if ".deploy" not in dir :
249+ ctf_dir = False
250+ if "challenges" not in dir :
251+ ctf_dir = False
252+ return ctf_dir
253+
254+
249255def terraform_binary () -> str :
250256 path = shutil .which (cmd = "tofu" )
251257 if not path :
You can’t perform that action at this time.
0 commit comments