mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-15 08:23:02 -03:00
fix: using realpath for fedora wine prefix
This commit is contained in:
@@ -199,7 +199,10 @@
|
||||
"game_removed_from_favorites": "Game removed from favorites",
|
||||
"game_added_to_favorites": "Game added to favorites",
|
||||
"automatically_extract_downloaded_files": "Automatically extract downloaded files",
|
||||
"create_start_menu_shortcut": "Create Start Menu shortcut"
|
||||
"create_start_menu_shortcut": "Create Start Menu shortcut",
|
||||
"invalid_wine_prefix_path": "Invalid Wine prefix path",
|
||||
"invalid_wine_prefix_path_description": "The path to the Wine prefix is invalid. Please check the path and try again.",
|
||||
"missing_wine_prefix": "Wine prefix is required to create a backup on Linux"
|
||||
},
|
||||
"activation": {
|
||||
"title": "Activate Hydra",
|
||||
|
||||
@@ -198,7 +198,10 @@
|
||||
"download_error_not_cached_on_real_debrid": "Esta descarga no está disponible en Real-Debrid y el estado de descarga del sondeo de Real-Debrid aún no está disponible.",
|
||||
"download_error_not_cached_on_torbox": "Esta descarga no está disponible en TorBox y el estado de descarga del sondeo aún no está disponible.",
|
||||
"game_added_to_favorites": "Juego añadido a favoritos",
|
||||
"game_removed_from_favorites": "Juego removido de favoritos"
|
||||
"game_removed_from_favorites": "Juego removido de favoritos",
|
||||
"invalid_wine_prefix_path": "Ruta de prefixo Wine inválida",
|
||||
"invalid_wine_prefix_path_description": "La ruta al prefixo Wine es inválida. Por favor, verifica la ruta y vuelve a intentarlo.",
|
||||
"missing_wine_prefix": ""
|
||||
},
|
||||
"activation": {
|
||||
"title": "Activar Hydra",
|
||||
|
||||
@@ -188,7 +188,9 @@
|
||||
"game_removed_from_favorites": "Jogo removido dos favoritos",
|
||||
"game_added_to_favorites": "Jogo adicionado aos favoritos",
|
||||
"automatically_extract_downloaded_files": "Extrair automaticamente os arquivos baixados",
|
||||
"create_start_menu_shortcut": "Criar atalho no Menu Iniciar"
|
||||
"create_start_menu_shortcut": "Criar atalho no Menu Iniciar",
|
||||
"invalid_wine_prefix_path": "Caminho do prefixo Wine inválido",
|
||||
"invalid_wine_prefix_path_description": "O caminho para o prefixo Wine é inválido. Por favor, verifique o caminho e tente novamente."
|
||||
},
|
||||
"activation": {
|
||||
"title": "Ativação",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { SystemPath } from "@main/services";
|
||||
import { logger, SystemPath } from "@main/services";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { registerEvent } from "../register-event";
|
||||
@@ -6,20 +6,26 @@ import { registerEvent } from "../register-event";
|
||||
const getDefaultWinePrefixSelectionPath = async (
|
||||
_event: Electron.IpcMainInvokeEvent
|
||||
) => {
|
||||
const steamWinePrefixes = path.join(
|
||||
SystemPath.getPath("home"),
|
||||
".local",
|
||||
"share",
|
||||
"Steam",
|
||||
"steamapps",
|
||||
"compatdata"
|
||||
);
|
||||
try {
|
||||
const steamWinePrefixes = path.join(
|
||||
SystemPath.getPath("home"),
|
||||
".local",
|
||||
"share",
|
||||
"Steam",
|
||||
"steamapps",
|
||||
"compatdata"
|
||||
);
|
||||
|
||||
if (fs.existsSync(steamWinePrefixes)) {
|
||||
return steamWinePrefixes;
|
||||
if (fs.existsSync(steamWinePrefixes)) {
|
||||
return fs.promises.realpath(steamWinePrefixes);
|
||||
}
|
||||
|
||||
return null;
|
||||
} catch (err) {
|
||||
logger.error("Failed to get default wine prefix selection path", err);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
registerEvent(
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { registerEvent } from "../register-event";
|
||||
import fs from "node:fs";
|
||||
import { levelKeys, gamesSublevel } from "@main/level";
|
||||
import { Wine } from "@main/services";
|
||||
import type { GameShop } from "@types";
|
||||
@@ -9,19 +10,30 @@ const selectGameWinePrefix = async (
|
||||
objectId: string,
|
||||
winePrefixPath: string | null
|
||||
) => {
|
||||
if (winePrefixPath && !Wine.validatePrefix(winePrefixPath)) {
|
||||
throw new Error("Invalid wine prefix path");
|
||||
}
|
||||
|
||||
const gameKey = levelKeys.game(shop, objectId);
|
||||
|
||||
const game = await gamesSublevel.get(gameKey);
|
||||
|
||||
if (!game) return;
|
||||
|
||||
if (!winePrefixPath) {
|
||||
await gamesSublevel.put(gameKey, {
|
||||
...game,
|
||||
winePrefixPath: null,
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const realWinePrefixPath = await fs.promises.realpath(winePrefixPath);
|
||||
|
||||
if (!Wine.validatePrefix(realWinePrefixPath)) {
|
||||
throw new Error("Invalid wine prefix path");
|
||||
}
|
||||
|
||||
await gamesSublevel.put(gameKey, {
|
||||
...game,
|
||||
winePrefixPath: winePrefixPath,
|
||||
winePrefixPath: realWinePrefixPath,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -135,10 +135,12 @@ export class CloudSync {
|
||||
shop,
|
||||
objectId,
|
||||
hostname: os.hostname(),
|
||||
winePrefixPath: game?.winePrefixPath ?? null,
|
||||
winePrefixPath: game?.winePrefixPath
|
||||
? fs.realpathSync(game.winePrefixPath)
|
||||
: null,
|
||||
homeDir: this.getWindowsLikeUserProfilePath(game?.winePrefixPath ?? null),
|
||||
downloadOptionTitle,
|
||||
platform: os.platform(),
|
||||
platform: process.platform,
|
||||
label,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user