fix(http-client): find the generated request scratch on Windows (#356)

Generate Request in HTTP Client (and Generate Requests for Controller, and the gutter icon) left the scratch file empty on Windows with "Cannot open file …\ai.l0ng.openidea/scratches/generated-requests.http": the scratch path joined the native app data directory (backslashes) with a /-separated suffix, so the opened editor could not be found by its path. Scratch paths now normalise the app data directory to the UI's /-separated form through a shared ipcPath helper, used by scratches, the HTTP client and Spring request generation.

Co-authored-by: kevinh458 <[email protected]>

未在 Windows 实机验证。
Цей коміт міститься в:
kevinh authored and GitHub committed 2026-10-30 15:09:50 +08:00
1 джерело 9575500dd6
коміт 9d1fe17894
7 files changed
+144 -4

No files matched your search

+6 -1
Переглянути файл
@@ -4,6 +4,7 @@
* `scratch[_n].<ext>` name and opens it as a normal document.
*/
import { IpcError, call, commands, emitLocalIdeEvent, isTauri } from "@/platform/ipc";
import { ipcPath } from "@/platform/paths";
import { editorService, notifications } from "@/workbench/contributions";
import { scratchFileName, scratchLanguages, type ScratchLanguage } from "./model";
@@ -18,7 +19,11 @@ export interface ScratchBackend {
}
export const tauriScratchBackend: ScratchBackend = {
dataDir: async () => (await import("@tauri-apps/api/path")).appDataDir(),
// `appDataDir()` is native (`C:\…`); the scratch paths are used as UI paths.
dataDir: async () => {
const { appDataDir } = await import("@tauri-apps/api/path");
return ipcPath(await appDataDir());
},
listNames: async (dir) => (await call(commands.fsReadDir(dir))).map((e) => e.name),
createDir: async (dir) => void (await call(commands.fsCreateDir(dir))),
createFile: async (path) => void (await call(commands.fsCreateFile(path))),