mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-01-24 05:54:55 +03:00
fix: normalizing windows paths
This commit is contained in:
parent
0f1ed20bbb
commit
1705b89355
@ -9,6 +9,7 @@ import { backupsPath } from "@main/constants";
|
|||||||
import type { GameShop } from "@types";
|
import type { GameShop } from "@types";
|
||||||
|
|
||||||
import YAML from "yaml";
|
import YAML from "yaml";
|
||||||
|
import { normalizePath } from "@main/helpers";
|
||||||
|
|
||||||
export interface LudusaviBackup {
|
export interface LudusaviBackup {
|
||||||
files: {
|
files: {
|
||||||
@ -31,7 +32,7 @@ const replaceLudusaviBackupWithCurrentUser = (
|
|||||||
drives: Record<string, string>;
|
drives: Record<string, string>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const currentHomeDir = app.getPath("home");
|
const currentHomeDir = normalizePath(app.getPath("home"));
|
||||||
|
|
||||||
// TODO: Only works on Windows
|
// TODO: Only works on Windows
|
||||||
const usersDirPath = path.join(gameBackupPath, "drive-C", "Users");
|
const usersDirPath = path.join(gameBackupPath, "drive-C", "Users");
|
||||||
@ -124,7 +125,7 @@ const downloadGameArtifact = async (
|
|||||||
|
|
||||||
replaceLudusaviBackupWithCurrentUser(
|
replaceLudusaviBackupWithCurrentUser(
|
||||||
path.join(backupPath, game),
|
path.join(backupPath, game),
|
||||||
path.normalize(homeDir).replace(/\\/g, "/")
|
normalizePath(path.normalize(homeDir))
|
||||||
);
|
);
|
||||||
|
|
||||||
Ludusavi.restoreBackup(backupPath).then(() => {
|
Ludusavi.restoreBackup(backupPath).then(() => {
|
||||||
|
@ -9,6 +9,7 @@ import axios from "axios";
|
|||||||
import os from "node:os";
|
import os from "node:os";
|
||||||
import { backupsPath } from "@main/constants";
|
import { backupsPath } from "@main/constants";
|
||||||
import { app } from "electron";
|
import { app } from "electron";
|
||||||
|
import { normalizePath } from "@main/helpers";
|
||||||
|
|
||||||
const bundleBackup = async (shop: GameShop, objectId: string) => {
|
const bundleBackup = async (shop: GameShop, objectId: string) => {
|
||||||
const backupPath = path.join(backupsPath, `${shop}-${objectId}`);
|
const backupPath = path.join(backupsPath, `${shop}-${objectId}`);
|
||||||
@ -55,7 +56,7 @@ const uploadSaveGame = async (
|
|||||||
shop,
|
shop,
|
||||||
objectId,
|
objectId,
|
||||||
hostname: os.hostname(),
|
hostname: os.hostname(),
|
||||||
homeDir: path.normalize(app.getPath("home")).replace(/\\/g, "/"),
|
homeDir: normalizePath(app.getPath("home")),
|
||||||
platform: os.platform(),
|
platform: os.platform(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { JSDOM } from "jsdom";
|
import { JSDOM } from "jsdom";
|
||||||
import UserAgent from "user-agents";
|
import UserAgent from "user-agents";
|
||||||
|
import path from "node:path";
|
||||||
|
|
||||||
export const getFileBuffer = async (url: string) =>
|
export const getFileBuffer = async (url: string) =>
|
||||||
fetch(url, { method: "GET" }).then((response) =>
|
fetch(url, { method: "GET" }).then((response) =>
|
||||||
@ -27,3 +28,6 @@ export const requestWebPage = async (url: string) => {
|
|||||||
|
|
||||||
export const isPortableVersion = () =>
|
export const isPortableVersion = () =>
|
||||||
process.env.PORTABLE_EXECUTABLE_FILE !== null;
|
process.env.PORTABLE_EXECUTABLE_FILE !== null;
|
||||||
|
|
||||||
|
export const normalizePath = (str: string) =>
|
||||||
|
path.normalize(str.replace(/\\/g, "/"));
|
||||||
|
Loading…
Reference in New Issue
Block a user