-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
-
Environment: macOS (Darwin 24.6.0), Node/electron-packager per
src/ui/package.json -
Steps to reproduce:
- Clone repo into a directory with spaces in the path.
- Run
./install.sh --prefix=./install --enable_ui.
-
Observed:
IndexError: list index out of rangeatinstall.pywhen scanning forOpenLeetCodeUI-*-*.
-
Root causes:
electron-packager--outpath wasn’t quoted, so packaging output could fail with spaces in path.- Installer assumed a match existed and indexed
[0]unguarded.
-
Fix:
- Quote
--outpath incmd_npx_build. - Check for matches before indexing and raise a clear error message if none.
- Quote
-
Bold fix: Quote the UI output path in the electron-packager command to support spaces in directories (e.g., “Interview Prep”).
- cmd_npx_build = f"npx electron-packager . --out={install_dir} --overwrite"
+ cmd_npx_build = f"npx electron-packager . --out=\"{install_dir}\" --overwrite"
- Bold fix: Make the UI artifact discovery robust. Previously it assumed at least one directory matched
OpenLeetCodeUI-*-*and crashed with IndexError. Now it checks for matches and raises a clear error if none are found, including directory listing and the command used.
- openleetcode_ui_dir = os.path.join(
- install_dir,
- [
- d for d in os.listdir(install_dir)
- if fnmatch.fnmatch(d, "OpenLeetCodeUI-*-*")
- ][0]
- )
+ matches = [
+ d for d in os.listdir(install_dir)
+ if fnmatch.fnmatch(d, "OpenLeetCodeUI-*-*")
+ ]
+ if not matches:
+ listing = "\n".join(sorted(os.listdir(install_dir)))
+ raise RuntimeError(
+ "electron-packager produced no output directory matching 'OpenLeetCodeUI-*-*'.\n"
+ f"Install dir contents:\n{listing}\n"
+ f"Command run: {cmd_npx_build}"
+ )
+ openleetcode_ui_dir = os.path.join(install_dir, matches[0])
Metadata
Metadata
Assignees
Labels
No labels