This repository has been archived on 2026-08-27. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
RequestCounter/bin/tests/findrootdir.py
T

28 lines
638 B
Python
Raw Permalink Normal View History

2022-02-16 13:10:46 +08:00
#!/usr/bin/env python3
# -- coding:utf-8 --
# @Author: markushammered@gmail.com
# @Development Tool: PyCharm
# @Create Time: 2022/2/16
# @File Name: findrootdir.py
import os
class Checkout:
def __init__(self, path: str):
self.path = path.split('/')[:-1]
def checkout_path(self, path: str):
if os.path.exists(f'{path}/utils'):
return True
else:
return False
def run(self):
for i in range(len(self.path)):
current_path = '/'.join('/'.join(self.path).split('/')[:-i])
if self.checkout_path(current_path):
return current_path