Skip to content

Commit

Permalink
fix: fixing sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
thegrannychaseroperation committed Jan 22, 2025
1 parent 71cb4cd commit 2aff983
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/main/events/library/open-game-installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const openGameInstaller = async (
const downloadKey = levelKeys.game(shop, objectId);
const download = await downloadsSublevel.get(downloadKey);

if (!download || !download.folderName) return true;
if (!download?.folderName) return true;

const gamePath = path.join(
download.downloadPath ?? (await getDownloadsPath()),
Expand Down
8 changes: 4 additions & 4 deletions src/main/services/download/download-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export class DownloadManager {
: undefined,
downloadsToSeed?.map((download) => ({
game_id: `${download.shop}-${download.objectId}`,
url: download.uri!,
save_path: download.downloadPath!,
url: download.uri,
save_path: download.downloadPath,
}))
);

Expand Down Expand Up @@ -187,7 +187,7 @@ export class DownloadManager {
if (!download) return;

const totalSize = await getDirSize(
path.join(download.downloadPath!, status.folderName)
path.join(download.downloadPath, status.folderName)
);

if (totalSize < status.fileSize) {
Expand Down Expand Up @@ -223,7 +223,7 @@ export class DownloadManager {
return this.startDownload(download);
}

static async cancelDownload(downloadKey = this.downloadingGameId!) {
static async cancelDownload(downloadKey = this.downloadingGameId) {
await PythonRPC.rpc.post("/action", {
action: "cancel",
game_id: downloadKey,
Expand Down
3 changes: 1 addition & 2 deletions src/main/services/notifications/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import icon from "@resources/icon.png?asset";
import { NotificationOptions, toXmlString } from "./xml";
import { logger } from "../logger";
import type { Game, UserPreferences } from "@types";
import { levelKeys } from "@main/level";
import { db } from "@main/level";
import { db, levelKeys } from "@main/level";

async function downloadImage(url: string | null) {
if (!url) return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function RepacksModal({
};

const checkIfLastDownloadedOption = (repack: GameRepack) => {
if (!game || !game.download) return false;
if (!game?.download) return false;
return repack.uris.some((uri) => uri.includes(game.download!.uri));
};

Expand Down

0 comments on commit 2aff983

Please sign in to comment.