sindresorhus/opn





Do you want to work on this issue?
You can request for a bounty in order to promote it!
Unable to open local files in wsl #174
captainjapeng posted onGitHub
I'm using this library from preview-email
library and it fails to open the generated html file on WSL
I have found a partial solution but missing a code to differentiate between a Web URL or a filesystem path
} else if (process.platform === 'win32' || isWsl) {
command = 'cmd' + (isWsl ? '.exe' : '');
cliArguments.push('/c', 'start', '""', '/b');
target = target.replace(/&/g, '^&');
if (options.wait) {
cliArguments.push('/wait');
}
if (options.app) {
if (isWsl && options.app.startsWith('/mnt/')) {
const windowsPath = await wslToWindowsPath(options.app);
options.app = windowsPath;
}
cliArguments.push(options.app);
}
// Convert local filepath to the one windows can understand
// Needs to differentiate between web url and filepath
if (isWsl) {
target = await wslToWindowsPath(target);
}
if (appArguments.length > 0) {
cliArguments.push(...appArguments);
}
} else {