Skip to content

Commit

Permalink
tweak click-opening WSL files (mintty/wsltty#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
mintty committed Jul 29, 2020
1 parent 497fe1f commit f92e984
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
33 changes: 30 additions & 3 deletions src/winmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -3752,7 +3752,22 @@ getlxssinfo(bool list, wstring wslname, uint * wsl_ver,
}
}
else { // legacy
rootfs = wcsdup(bp);
rootfs = newn(wchar, wcslen(bp) + 8);
wcscpy(rootfs, bp);
wcscat(rootfs, W("\\rootfs"));

char * rootdir = path_win_w_to_posix(rootfs);
struct stat fstat_buf;
if (stat (rootdir, & fstat_buf) == 0 && S_ISDIR (fstat_buf.st_mode)) {
// non-app or imported deployment
}
else {
// legacy Bash on Windows
free(rootfs);
rootfs = wcsdup(bp);
}
free(rootdir);

icon = legacy_icon();
}

Expand Down Expand Up @@ -3784,10 +3799,22 @@ getlxssinfo(bool list, wstring wslname, uint * wsl_ver,
printf("-- icon %ls\n", icon);
}

*wsl_icon = icon;
*wsl_ver = 1 + ((getregval(lxss, guid, W("Flags")) >> 3) & 1);
*wsl_guid = cs__wcstoutf(guid);
*wsl_rootfs = rootfs;
*wsl_icon = icon;
char * rootdir = path_win_w_to_posix(rootfs);
struct stat fstat_buf;
if (stat (rootdir, & fstat_buf) == 0 && S_ISDIR (fstat_buf.st_mode)) {
*wsl_rootfs = rootfs;
}
else {
free(rootfs);
rootfs = newn(wchar, wcslen(wslname) + 8);
wcscpy(rootfs, W("\\\\wsl$\\"));
wcscat(rootfs, wslname);
*wsl_rootfs = rootfs;
}
free(rootdir);
return 0;
}

Expand Down
1 change: 1 addition & 0 deletions wiki/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Window handling
* Prevent mouse wheel double interpretation, also fixing speed issues (mintty/wsltty#238).
* Handle proper link attributes when screen is scrolled (#1021).
* Image saving feature for terminal contents (png format), DEC and Tek.
* Tweak click-opening WSL files (mintty/wsltty#115).

Configuration
* Support resource configuration directories via links (#1016).
Expand Down

0 comments on commit f92e984

Please sign in to comment.