mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-18 16:53:57 +00:00
fix: adding path transformation for wine
This commit is contained in:
@@ -14,6 +14,8 @@ export const windowsStartMenuPath = path.join(
|
||||
"Programs"
|
||||
);
|
||||
|
||||
export const publicProfilePath = "C:/Users/Public";
|
||||
|
||||
export const levelDatabasePath = path.join(
|
||||
SystemPath.getPath("userData"),
|
||||
`hydra-db${isStaging ? "-staging" : ""}`
|
||||
|
||||
@@ -4,7 +4,7 @@ import * as tar from "tar";
|
||||
import { registerEvent } from "../register-event";
|
||||
import axios from "axios";
|
||||
import path from "node:path";
|
||||
import { backupsPath } from "@main/constants";
|
||||
import { backupsPath, publicProfilePath } from "@main/constants";
|
||||
import type { GameShop, LudusaviBackupMapping } from "@types";
|
||||
|
||||
import YAML from "yaml";
|
||||
@@ -21,6 +21,17 @@ export const transformLudusaviBackupPathIntoWindowsPath = (
|
||||
.replace("drive_c", "C:");
|
||||
};
|
||||
|
||||
export const addWinePrefixToWindowsPath = (
|
||||
windowsPath: string,
|
||||
winePrefixPath?: string | null
|
||||
) => {
|
||||
if (!winePrefixPath) {
|
||||
return windowsPath;
|
||||
}
|
||||
|
||||
return path.join(winePrefixPath, windowsPath.replace("C:", "drive_c"));
|
||||
};
|
||||
|
||||
const restoreLudusaviBackup = (
|
||||
backupPath: string,
|
||||
title: string,
|
||||
@@ -56,7 +67,15 @@ const restoreLudusaviBackup = (
|
||||
const destinationPath = transformLudusaviBackupPathIntoWindowsPath(
|
||||
key,
|
||||
artifactWinePrefixPath
|
||||
).replace(homeDir, userProfilePath);
|
||||
)
|
||||
.replace(
|
||||
homeDir,
|
||||
addWinePrefixToWindowsPath(userProfilePath, winePrefixPath)
|
||||
)
|
||||
.replace(
|
||||
publicProfilePath,
|
||||
addWinePrefixToWindowsPath(publicProfilePath, winePrefixPath)
|
||||
);
|
||||
|
||||
logger.info(`Moving ${sourcePath} to ${destinationPath}`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user