ソースを参照

Fix compatibility with node 10

dev_h
ophir 4年前
コミット
fbc66148d3
1個のファイルの変更3行の追加6行の削除
  1. 3
    6
      server/check_output_directory.js

+ 3
- 6
server/check_output_directory.js ファイルの表示

@@ -27,10 +27,8 @@ async function get_error(directory) {
27 27
             `user with UID ${uid} has access to them. This can be achieved by running the command: chown ${uid}:${gid} on the directory`;
28 28
     }
29 29
     const fileChecks = [];
30
-    const dir = fs.opendirSync(directory);
31
-    while (true) {
32
-        const elem = await dir.read();
33
-        if (!elem) break;
30
+    const files = await fs.promises.readdir(directory, {withFileTypes: true});
31
+    for (const elem of files) {
34 32
         if (/^board-(.*)\.json$/.test(elem.name)) {
35 33
             const elemPath = path.join(directory, elem.name);
36 34
             if (!elem.isFile()) return `contains a board file named "${elemPath}" which is not a normal file`
@@ -38,12 +36,11 @@ async function get_error(directory) {
38 36
                 .catch(function () { return elemPath }))
39 37
         }
40 38
     }
41
-    dir.closeSync();
42 39
     const errs = (await Promise.all(fileChecks)).filter(function (x) { return x });
43 40
     if (errs.length > 0) {
44 41
         return `contains the following board files that are not readable and writable by the current user: "` +
45 42
             errs.join('", "') +
46
-            `". Please make all board files accessible with chown 1000:1000.`
43
+            `". Please make all board files accessible with chown 1000:1000`
47 44
     }
48 45
 }
49 46
 

読み込み中…
キャンセル
保存