Unregister engine on uninstall (#7594)
Signed-off-by: Alex Peterson <26804013+AMZN-alexpete@users.noreply.github.com>
This commit is contained in:
@@ -36,6 +36,7 @@
|
|||||||
<Directory Id="root.cmake.runtime" Name="runtime"/>
|
<Directory Id="root.cmake.runtime" Name="runtime"/>
|
||||||
</Directory>
|
</Directory>
|
||||||
<Directory Id="root.python" Name="python"/>
|
<Directory Id="root.python" Name="python"/>
|
||||||
|
<Directory Id="root.scripts" Name="scripts"/>
|
||||||
<Directory Id="root.tools" Name="Tools">
|
<Directory Id="root.tools" Name="Tools">
|
||||||
<Directory Id="root.tools.redist" Name="Redistributables">
|
<Directory Id="root.tools.redist" Name="Redistributables">
|
||||||
<Directory Id="root.tools.redist.cmake" Name="CMake"/>
|
<Directory Id="root.tools.redist.cmake" Name="CMake"/>
|
||||||
@@ -61,5 +62,12 @@
|
|||||||
Execute="deferred"
|
Execute="deferred"
|
||||||
Impersonate="no"/>
|
Impersonate="no"/>
|
||||||
|
|
||||||
|
<CustomAction Id="UnRegisterEngine"
|
||||||
|
ExeCommand=""[SystemFolder]cmd.exe" /C @"[root.scripts]o3de.bat" register --remove --this-engine"
|
||||||
|
Directory="INSTALL_ROOT"
|
||||||
|
Execute="immediate"
|
||||||
|
Return="ignore"
|
||||||
|
Impersonate="no"/>
|
||||||
|
|
||||||
</Fragment>
|
</Fragment>
|
||||||
</Wix>
|
</Wix>
|
||||||
|
|||||||
@@ -58,6 +58,10 @@
|
|||||||
<Custom Action="ConfigurePython" After="MoveCMake">
|
<Custom Action="ConfigurePython" After="MoveCMake">
|
||||||
NOT Installed Or REINSTALL
|
NOT Installed Or REINSTALL
|
||||||
</Custom>
|
</Custom>
|
||||||
|
<!-- limit the unregister action to full uninstall -->
|
||||||
|
<Custom Action="UnRegisterEngine" After="InstallInitialize">
|
||||||
|
(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")
|
||||||
|
</Custom>
|
||||||
</InstallExecuteSequence>
|
</InstallExecuteSequence>
|
||||||
|
|
||||||
<UIRef Id="$(var.CPACK_WIX_UI_REF)" />
|
<UIRef Id="$(var.CPACK_WIX_UI_REF)" />
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ def remove_engine_name_to_path(json_data: dict,
|
|||||||
|
|
||||||
returns 0 to indicate no issues has occurred with removal
|
returns 0 to indicate no issues has occurred with removal
|
||||||
"""
|
"""
|
||||||
if engine_path.is_dir() and validation.valid_o3de_engine_json(engine_path):
|
if engine_path.is_dir() and validation.valid_o3de_engine_json(pathlib.Path(engine_path).resolve() / 'engine.json'):
|
||||||
engine_json_data = manifest.get_engine_json_data(engine_path=engine_path)
|
engine_json_data = manifest.get_engine_json_data(engine_path=engine_path)
|
||||||
if 'engine_name' in engine_json_data and 'engines_path' in json_data:
|
if 'engine_name' in engine_json_data and 'engines_path' in json_data:
|
||||||
engine_name = engine_json_data['engine_name']
|
engine_name = engine_json_data['engine_name']
|
||||||
@@ -234,6 +234,9 @@ def remove_engine_name_to_path(json_data: dict,
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
# Attempting to remove a non-existent engine_name is fine
|
# Attempting to remove a non-existent engine_name is fine
|
||||||
pass
|
pass
|
||||||
|
else:
|
||||||
|
logger.warning(f'Unable to find engine.json file or file is invalid at path {engine_path.as_posix()}')
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
@@ -354,8 +357,8 @@ def register_engine_path(json_data: dict,
|
|||||||
|
|
||||||
if remove:
|
if remove:
|
||||||
return remove_engine_name_to_path(json_data, engine_path)
|
return remove_engine_name_to_path(json_data, engine_path)
|
||||||
|
else:
|
||||||
return add_engine_name_to_path(json_data, engine_path, force)
|
return add_engine_name_to_path(json_data, engine_path, force)
|
||||||
|
|
||||||
|
|
||||||
def register_external_subdirectory(json_data: dict,
|
def register_external_subdirectory(json_data: dict,
|
||||||
@@ -797,7 +800,7 @@ def _run_register(args: argparse) -> int:
|
|||||||
remove_invalid_o3de_objects()
|
remove_invalid_o3de_objects()
|
||||||
return repo.refresh_repos()
|
return repo.refresh_repos()
|
||||||
elif args.this_engine:
|
elif args.this_engine:
|
||||||
ret_val = register(engine_path=manifest.get_this_engine_path(), force=args.force)
|
ret_val = register(engine_path=manifest.get_this_engine_path(), force=args.force, remove=args.remove)
|
||||||
return ret_val
|
return ret_val
|
||||||
elif args.all_engines_path:
|
elif args.all_engines_path:
|
||||||
return register_all_engines_in_folder(args.all_engines_path, args.remove, args.force)
|
return register_all_engines_in_folder(args.all_engines_path, args.remove, args.force)
|
||||||
|
|||||||
Reference in New Issue
Block a user