Skip to content

Commit abef0d2

Browse files
committed
implemented guessing of exepected version filepath
1 parent bbfe926 commit abef0d2

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

common/ayon_common/distribution/control.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,6 +1893,35 @@ def installer_executable(self) -> Optional[str]:
18931893
if path and filename == "ayon_console.exe":
18941894
path = os.path.join(os.path.dirname(path), filename)
18951895

1896+
if path:
1897+
self._installer_executable = path
1898+
return path
1899+
1900+
# Guess based on "expected" path of the version
1901+
# - is used if the AYON is already installed at target location but is
1902+
# missing in the metadata file
1903+
current_version = os.environ["AYON_VERSION"]
1904+
platform_name = platform.system().lower()
1905+
if platform_name in {"windows", "linux"}:
1906+
executable_dir, exe_name = os.path.split(sys.executable)
1907+
install_root, dirname = os.path.split(executable_dir)
1908+
if current_version in dirname:
1909+
new_dirname = dirname.replace(
1910+
current_version,
1911+
self.expected_installer_version
1912+
)
1913+
executable = os.path.join(
1914+
install_root, new_dirname, exe_name
1915+
)
1916+
if os.path.exists(executable):
1917+
path = executable
1918+
1919+
elif platform_name == "darwin":
1920+
app_name = f"AYON {self.expected_installer_version}.app"
1921+
excutable = f"/Applications/{app_name}/Contents/MacOS/ayon"
1922+
if os.path.exists(excutable):
1923+
path = excutable
1924+
18961925
self._installer_executable = path
18971926
return path
18981927

0 commit comments

Comments
 (0)