mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-10 03:03:37 +02:00
Fix Windows paths for new plugin runtime
This commit is contained in:
@@ -8,9 +8,11 @@ import { parentPort, workerData } from 'node:worker_threads';
|
|||||||
|
|
||||||
new Promise<void>(async (resolve, reject) => {
|
new Promise<void>(async (resolve, reject) => {
|
||||||
const { pluginDir /*, pluginRefId*/ } = workerData;
|
const { pluginDir /*, pluginRefId*/ } = workerData;
|
||||||
const pathMod = path.join(pluginDir, 'build/index.js');
|
|
||||||
const pathPkg = path.join(pluginDir, 'package.json');
|
const pathPkg = path.join(pluginDir, 'package.json');
|
||||||
|
|
||||||
|
// NOTE: Use POSIX join because require() needs forward slash
|
||||||
|
const pathMod = path.posix.join(pluginDir, 'build', 'index.js');
|
||||||
|
|
||||||
let pkg: { [x: string]: any };
|
let pkg: { [x: string]: any };
|
||||||
try {
|
try {
|
||||||
pkg = JSON.parse(readFileSync(pathPkg, 'utf8'));
|
pkg = JSON.parse(readFileSync(pathPkg, 'utf8'));
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -112,12 +112,11 @@ async fn read_plugins_dir(dir: &PathBuf) -> Result<Vec<String>> {
|
|||||||
Ok(dirs)
|
Ok(dirs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
fn fix_windows_paths(p: &PathBuf) -> String {
|
fn fix_windows_paths(p: &PathBuf) -> String {
|
||||||
use dunce;
|
use dunce;
|
||||||
use regex::Regex;
|
|
||||||
use path_slash::PathBufExt;
|
use path_slash::PathBufExt;
|
||||||
|
use regex::Regex;
|
||||||
|
|
||||||
// 1. Remove UNC prefix for Windows paths to pass to sidecar
|
// 1. Remove UNC prefix for Windows paths to pass to sidecar
|
||||||
let safe_path = dunce::simplified(p.as_path()).to_string_lossy().to_string();
|
let safe_path = dunce::simplified(p.as_path()).to_string_lossy().to_string();
|
||||||
|
|||||||
Reference in New Issue
Block a user