дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-06 18:17:15 +02:00
In an SSH or WSL window, Export Test Results passed a path picked in the desktop's Save dialog to the project host. Project-side pickers (Export Test Results, Save As, patch and Git dialogs, Maven/Gradle linking, scopes, coverage and Java sources, database source files, deployment destinations, tool and plugin paths) now browse the project host, with overwrite confirmation kept; flows whose files belong to the desktop (keymap and color scheme import/export, database and ACP imports, Clone) read and write through the desktop process. Follow-up to #5439.
25 рядки
1.0 KiB
TypeScript
25 рядки
1.0 KiB
TypeScript
import { toBase64 } from "./base64";
|
|
import { call, callDesktop, commands, isErrorKind } from "./ipc";
|
|
import { isRemoteWindow } from "./remote";
|
|
|
|
/** Text selected in the desktop's file dialog, including in a remote window. */
|
|
export function readDesktopText(path: string): Promise<string> {
|
|
return isRemoteWindow() ? callDesktop<string>("fs_read_text", { path }) : call(commands.fsReadText(path));
|
|
}
|
|
|
|
/** Write UTF-8 to a path already confirmed in the desktop's save dialog. */
|
|
export async function writeDesktopText(path: string, text: string): Promise<void> {
|
|
const data = toBase64(new TextEncoder().encode(text));
|
|
if (!isRemoteWindow()) {
|
|
await call(commands.fsDelete(path)).catch(() => {});
|
|
await call(commands.fsCreateFileBytes(path, data));
|
|
return;
|
|
}
|
|
const kind = await callDesktop<string>("fs_entry_kind", { path }).catch((e: unknown) => {
|
|
if (!isErrorKind(e, "notFound")) throw e;
|
|
return null;
|
|
});
|
|
if (kind === "file") await callDesktop("fs_delete", { path });
|
|
await callDesktop("fs_create_file_bytes", { path, data });
|
|
}
|