fix: moving constant

This commit is contained in:
Chubby Granny Chaser
2025-10-22 17:37:00 +01:00
parent ddbac621fb
commit 68b3de9b7f
2 changed files with 10 additions and 5 deletions

View File

@@ -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");

View File

@@ -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(