Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ’cannot find unity app‘ error #38

Open
wants to merge 3 commits into
base: vr
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions furniture/env/unity_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,11 @@ def _download_unity(self):
zip_file.extractall()
else:
logger.info("Downloading Unity app from %s", url)
gdown.cached_download(url, zip_path, postprocess=gdown.extractall)
gdown.cached_download(url, str(zip_path), postprocess=gdown.extractall)

file_path = Path(__file__).parents[2] / APP_FILE_NAME[platform][:-4]
if file_path.exists:
self._rename_unity_dir()

if platform == "darwin":
binary_path = zip_dir / "binary/Furniture.app/Contents/MacOS/Furniture"
Expand All @@ -198,7 +202,6 @@ def _download_unity(self):
def _find_unity_path(self):
"""Finds path to Unity app."""
binary_dir = Path(__file__).parents[2] / "binary"

launch_string = None
if platform == "linux" or platform == "linux2":
candidates = list(binary_dir.glob("Furniture.x86_64"))
Expand Down Expand Up @@ -287,3 +290,12 @@ def close(self):
else:
os.killpg(os.getpgid(self.proc1.pid), signal.SIGTERM)
self.proc1 = None

def _rename_unity_dir(self):
"""Rename the unzipped unity directory"""
file_path = Path(__file__).parents[2] / APP_FILE_NAME[platform][:-4]
if file_path.exists():
new_path = Path(__file__).parents[2] / "binary"
os.rename(file_path, new_path)
else:
logger.info("can't find unzipped unity directory")