Skip to content

Commit

Permalink
Merge pull request #2 from YajJackson/fix-find-project-root
Browse files Browse the repository at this point in the history
fix macos directory issue when finding project root
  • Loading branch information
YajJackson authored Apr 13, 2024
2 parents 9289fb7 + 170de21 commit 63a65ba
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pyright.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements_dev.txt
- name: Run Pyright
uses: YajJackson/[email protected]
Expand Down
7 changes: 4 additions & 3 deletions godot_parser/util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Utils """

import json
import os
from typing import Optional
Expand Down Expand Up @@ -27,9 +28,9 @@ def stringify_object(value):


def find_project_root(start: str) -> Optional[str]:
curdir = start
if os.path.isfile(start):
curdir = os.path.dirname(start)
curdir = os.path.realpath(start) # Ensure start is a real path
if os.path.isfile(curdir):
curdir = os.path.dirname(curdir)
while True:
if os.path.isfile(os.path.join(curdir, "project.godot")):
return curdir
Expand Down
5 changes: 1 addition & 4 deletions tests/test_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class TestTree(unittest.TestCase):

"""Test the the high-level tree API"""

def test_get_node(self):
Expand Down Expand Up @@ -107,7 +106,6 @@ def test_dunder(self):


class TestInheritedScenes(unittest.TestCase):

"""Test the the high-level tree API for inherited scenes"""

project_dir = None
Expand All @@ -118,7 +116,7 @@ class TestInheritedScenes(unittest.TestCase):
@classmethod
def setUpClass(cls):
super(TestInheritedScenes, cls).setUpClass()
cls.project_dir = tempfile.mkdtemp()
cls.project_dir = os.path.realpath(tempfile.mkdtemp())
with open(
os.path.join(cls.project_dir, "project.godot"), "w", encoding="utf-8"
) as ofile:
Expand Down Expand Up @@ -300,7 +298,6 @@ def test_missing_ext_resource(self):


class TestUtil(unittest.TestCase):

"""Tests for util"""

def test_bad_gdpath(self):
Expand Down

0 comments on commit 63a65ba

Please sign in to comment.