Initial set of tools for editing/running projects
This commit is contained in:
15
goat/util.py
Normal file
15
goat/util.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import os
|
||||
|
||||
def find_nearest(path, test):
|
||||
path = os.path.abspath(path)
|
||||
|
||||
while True:
|
||||
parent_path = os.path.dirname(path)
|
||||
for entry in os.listdir(path):
|
||||
if test(entry):
|
||||
return path
|
||||
|
||||
if parent_path == path:
|
||||
return None
|
||||
|
||||
path = parent_path
|
||||
Reference in New Issue
Block a user