aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin Borner2020-07-18 22:30:58 +0200
committerMarvin Borner2020-07-18 22:30:58 +0200
commitd3c4b447c3d882a77282e32d9e12d7c3d4f034a2 (patch)
tree8403e8b7aec8617bb76e699c761f9460e9193269
parentf8cff89de2ef165748362cf0f104e2bf7bf88618 (diff)
Existence verification
-rw-r--r--src/util/files.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/util/files.ts b/src/util/files.ts
index e516258..49c5ebb 100644
--- a/src/util/files.ts
+++ b/src/util/files.ts
@@ -1,5 +1,4 @@
-import { ensureDirSync } from "https://deno.land/std/fs/mod.ts";
-import { walk } from "https://deno.land/std/fs/mod.ts";
+import { walk, ensureDirSync, existsSync } from "https://deno.land/std/fs/mod.ts";
const TEMP_USER_ID = 42; // TODO: FIX
@@ -23,7 +22,8 @@ export const getFiles = async (path: string) => {
createUserDirectory(TEMP_USER_ID);
const dataPath: string = cleanPath(newPath);
- console.log(dataPath);
+
+ if (!existsSync(dataPath)) return [];
const files = [];
for await (const entry of walk(dataPath)) {