mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 17:41:40 -05:00
commit
e30385eba4
2 changed files with 13 additions and 9 deletions
|
@ -4745,7 +4745,7 @@ async function js_helper(str: string[]) {
|
||||||
let sourcePath = jsContent
|
let sourcePath = jsContent
|
||||||
if (fromRC) {
|
if (fromRC) {
|
||||||
const sep = "/"
|
const sep = "/"
|
||||||
const rcPath = (await Native.getrcpath()).split(sep).slice(0, -1)
|
const rcPath = (await Native.getrcpath("unix")).split(sep).slice(0, -1)
|
||||||
sourcePath = [...rcPath, sourcePath].join(sep)
|
sourcePath = [...rcPath, sourcePath].join(sep)
|
||||||
}
|
}
|
||||||
const file = await Native.read(sourcePath)
|
const file = await Native.read(sourcePath)
|
||||||
|
|
|
@ -58,11 +58,15 @@ async function sendNativeMsg(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getrcpath(): Promise<string> {
|
export async function getrcpath(separator: "unix" | "auto" = "auto"): Promise<string> {
|
||||||
const res = await sendNativeMsg("getconfigpath", {})
|
const res = await sendNativeMsg("getconfigpath", {})
|
||||||
|
|
||||||
if (res.code !== 0) throw new Error("getrcpath error: " + res.code)
|
if (res.code !== 0) throw new Error("getrcpath error: " + res.code)
|
||||||
|
|
||||||
|
if (separator == "unix" && (await browserBg.runtime.getPlatformInfo()).os == "win") {
|
||||||
|
return res.content.replace(/\\/g, "/")
|
||||||
|
}
|
||||||
|
else
|
||||||
return res.content
|
return res.content
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue