Skip to content

Commit

Permalink
fix: check if local cf path exist
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackDark committed Apr 1, 2024
1 parent f1642c5 commit 781e2f5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/custom-formats.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { readdirSync } from "fs";
import fs, { readdirSync } from "fs";
import path from "path";
import { CustomFormatResource } from "./__generated__/generated-sonarr-api";
import { getArrApi } from "./api";
Expand Down Expand Up @@ -91,6 +91,12 @@ export const loadLocalCfs = async (): Promise<CFProcessing | null> => {
}

const cfPath = path.resolve(config.localCustomFormatsPath);

if (!fs.existsSync(cfPath)) {
console.log(`Provided local custom formats path '${config.localCustomFormatsPath}' does not exist.`);
return null;
}

const files = readdirSync(`${cfPath}`).filter((fn) => fn.endsWith("json"));
const carrIdToObject = new Map<string, { carrConfig: ConfigarrCF; requestConfig: CustomFormatResource }>();
const cfNameToCarrObject = new Map<string, ConfigarrCF>();
Expand Down

0 comments on commit 781e2f5

Please sign in to comment.