Skip to content

fix: use full executable path for editors on Windows in Git BashFix/edit intellij windows gitbash#2451

Closed
Bhumika-SN wants to merge 3 commits into
jbangdev:mainfrom
Bhumika-SN:fix/edit-intellij-windows-gitbash
Closed

fix: use full executable path for editors on Windows in Git BashFix/edit intellij windows gitbash#2451
Bhumika-SN wants to merge 3 commits into
jbangdev:mainfrom
Bhumika-SN:fix/edit-intellij-windows-gitbash

Conversation

@Bhumika-SN
Copy link
Copy Markdown
Contributor

Problem

Fixes #1340

On Windows with Git Bash, jbang edit finds IntelliJ's idea on PATH
correctly but then tries to execute just "idea" instead of the full
path like "idea.bat".

Util.searchPath() correctly resolves the full path with extension,
but findEditorsOnPath() was discarding that result and returning
just the plain editor name.

Fix

On Windows, use the full resolved path returned by Util.searchPath()
instead of the plain editor name, so Git Bash can execute it correctly.

private static List<String> findEditorsOnPath() {
return Arrays.stream(knownEditors).filter(e -> Util.searchPath(e) != null).collect(Collectors.toList());
return Arrays.stream(knownEditors)
.filter(e -> Util.searchPath(e) != null)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is going to 2x the calls to searchPath() that does not seem right.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we simply return the right name ? idea.bat ? or exec it shell?

dir = Paths.get(System.getProperty("user.home")).resolve(".jbang");
// On Windows, USERPROFILE is more reliable than user.home for non-ASCII
// usernames
String home = Util.isWindows()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this overlaps with #2450

depCache = null;
// Also clear the dependency cache JSON file from disk
try {
Path cacheFile = Settings.getCacheDependencyFile();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this does not seem related to this issue?

@Bhumika-SN Bhumika-SN closed this May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

edit: IntelliJ found in PATH won't start on Windows

2 participants