Skip to content

Commit 781e2f5

Browse files
committed
fix: check if local cf path exist
1 parent f1642c5 commit 781e2f5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/custom-formats.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { readdirSync } from "fs";
1+
import fs, { readdirSync } from "fs";
22
import path from "path";
33
import { CustomFormatResource } from "./__generated__/generated-sonarr-api";
44
import { getArrApi } from "./api";
@@ -91,6 +91,12 @@ export const loadLocalCfs = async (): Promise<CFProcessing | null> => {
9191
}
9292

9393
const cfPath = path.resolve(config.localCustomFormatsPath);
94+
95+
if (!fs.existsSync(cfPath)) {
96+
console.log(`Provided local custom formats path '${config.localCustomFormatsPath}' does not exist.`);
97+
return null;
98+
}
99+
94100
const files = readdirSync(`${cfPath}`).filter((fn) => fn.endsWith("json"));
95101
const carrIdToObject = new Map<string, { carrConfig: ConfigarrCF; requestConfig: CustomFormatResource }>();
96102
const cfNameToCarrObject = new Map<string, ConfigarrCF>();

0 commit comments

Comments
 (0)