Skip to content

Commit 93a62a1

Browse files
update path
1 parent f5d6b59 commit 93a62a1

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/study_smart/google_calendar.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,16 @@
1717

1818
SCOPES = ["https://www.googleapis.com/auth/calendar"]
1919

20-
# paths to credentials files — relative to repo root
21-
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
22-
ROOT_DIR = os.path.dirname(os.path.dirname(BASE_DIR))
20+
def _find_repo_root():
21+
"""Find repo root by looking for pyproject.toml."""
22+
current = os.path.dirname(os.path.abspath(__file__))
23+
for _ in range(5):
24+
if os.path.exists(os.path.join(current, "pyproject.toml")):
25+
return current
26+
current = os.path.dirname(current)
27+
return os.path.dirname(os.path.abspath(__file__))
28+
29+
ROOT_DIR = _find_repo_root()
2330
CREDENTIALS_PATH = os.path.join(ROOT_DIR, "credentials.json")
2431
TOKEN_PATH = os.path.join(ROOT_DIR, "token.json")
2532

0 commit comments

Comments
 (0)