Skip to content

[BUG] (Windows) Exception on launch when Native Hub is on a different drive than editor installation #56

@Valthoron

Description

@Valthoron

Description
If the Native Hub executable is on a different drive than the Unity editor installation, launching it after the first time fails with the exception:

Unhandled standard exception of type "class std::filesystem::filesystem_error" with message "directory_iterator::directory_iterator: The system cannot find the path specified.: "\Program Files\Unity\Hub\Editor""; terminating the application.

%AppData%\UnityHubNative\editorPaths.txt indeed contains \Program Files\Unity\Hub\Editor without the drive letter as the editor path. This path refers to a directory on the same drive as the executable, which doesn't exist.

editorPaths.txt can be edited manually to add the correct drive letter, fixing the problem. If the file is deleted, it is created again without the drive letter.

To Reproduce

  1. Use a computer that has never run Native Hub before, or delete the UnityHubNative directory in %AppData%.
  2. Place Native Hub executable on a different drive than the Unity installation. For example, if Unity is installed on the default path in C:, have the executable on D:.
  3. Start Native Hub for the first time, without an error.
  4. Close Native Hub.
  5. Start Native Hub for the second time.
  6. Exception is thrown and Native Hub closes.

Expected behavior

  1. The editor path should be saved including the drive letter, i.e. as "absolute path".
  2. If the editor directory is not found, Native Hub should not close with an exception. It should re-scan or ask the user for a valid directory.

Computer information:

  • OS: Windows 10 Pro 22H2 x64

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions