We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f5d6b59 commit 93a62a1Copy full SHA for 93a62a1
1 file changed
src/study_smart/google_calendar.py
@@ -17,9 +17,16 @@
17
18
SCOPES = ["https://www.googleapis.com/auth/calendar"]
19
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))
+def _find_repo_root():
+ """Find repo root by looking for pyproject.toml."""
+ 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()
30
CREDENTIALS_PATH = os.path.join(ROOT_DIR, "credentials.json")
31
TOKEN_PATH = os.path.join(ROOT_DIR, "token.json")
32
0 commit comments