mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-17 16:33:55 +00:00
fix: moving constant
This commit is contained in:
@@ -31,6 +31,11 @@ export const logsPath = path.join(
|
||||
`logs${isStaging ? "-staging" : ""}`
|
||||
);
|
||||
|
||||
export const screenshotsPath = path.join(
|
||||
SystemPath.getPath("userData"),
|
||||
"Screenshots"
|
||||
);
|
||||
|
||||
export const achievementSoundPath = app.isPackaged
|
||||
? path.join(process.resourcesPath, "achievement.wav")
|
||||
: path.join(__dirname, "..", "..", "resources", "achievement.wav");
|
||||
|
||||
@@ -2,6 +2,7 @@ import { desktopCapturer, nativeImage, app } from "electron";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { logger } from "./logger";
|
||||
import { screenshotsPath } from "@main/constants";
|
||||
|
||||
export class ScreenshotService {
|
||||
private static readonly SCREENSHOT_QUALITY = 80;
|
||||
@@ -50,6 +51,8 @@ export class ScreenshotService {
|
||||
throw new Error("No desktop sources available for screenshot");
|
||||
}
|
||||
|
||||
console.log("sources", sources);
|
||||
|
||||
const primaryScreen = sources[0];
|
||||
|
||||
const originalImage = nativeImage.createFromDataURL(
|
||||
@@ -58,15 +61,12 @@ export class ScreenshotService {
|
||||
|
||||
const compressedImage = this.compressImage(originalImage);
|
||||
|
||||
const userDataPath = app.getPath("userData");
|
||||
const screenshotsDir = path.join(userDataPath, "screenshots");
|
||||
|
||||
let finalDir = screenshotsDir;
|
||||
let finalDir = screenshotsPath;
|
||||
let filename: string;
|
||||
|
||||
if (gameTitle && achievementName) {
|
||||
const sanitizedGameTitle = gameTitle.replaceAll(/[<>:"/\\|?*]/g, "_");
|
||||
const gameDir = path.join(screenshotsDir, sanitizedGameTitle);
|
||||
const gameDir = path.join(screenshotsPath, sanitizedGameTitle);
|
||||
finalDir = gameDir;
|
||||
|
||||
const sanitizedAchievementName = achievementName.replaceAll(
|
||||
|
||||
Reference in New Issue
Block a user