Skip to content

'ue4 setroot' saves the root even when specified directory is NOT valid #68

@sleeptightAnsiC

Description

@sleeptightAnsiC
$ ue4 setroot jndksfjnaskldjfnksda
Set engine root path override: /home/kornel/Projects/ue4cli/jndksfjnaskldjfnksda
Using user-specified engine root: /home/kornel/Projects/ue4cli/jndksfjnaskldjfnksda
Warning: the specified directory does not appear to contain a valid version of the Unreal Engine.
# return code 0

$ ue4 root
Using user-specified engine root: /home/kornel/Projects/ue4cli/jndksfjnaskldjfnksda
/home/kornel/Projects/ue4cli/jndksfjnaskldjfnksda
# return code 0

This should not happen. Setting root override to a non-valid Engine directory should fail.
Currently it always saves the override no matter what, and only prints warning.

In #65 I already changed warning to error by throwing UnrealManagerException.
Now I need to also prevent the override from being saved.

This is a bit tricky to fix as currently we save the override first and then validate it afterwards:

def setEngineRootOverride(self, rootDir):
"""
Sets a user-specified directory as the root engine directory, overriding any auto-detection
"""
# Set the new root directory
rootDir = os.path.abspath(rootDir)
ConfigurationManager.setConfigKey('rootDirOverride', rootDir)
print('Set engine root path override: {}'.format(rootDir))
# Check that the specified directory is valid and warn the user if it is not
try:
self.getEngineVersion()
except:
print('Warning: the specified directory does not appear to contain a valid version of the Unreal Engine.')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions