Skip to content

Commit

Permalink
Fixed dirpath being undefined on windows in GitHub.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Naviary2 committed Jan 9, 2025
1 parent 3c9041d commit e3a950f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/server/api/GitHub.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import { join } from 'node:path';
import { readFileIfExists } from '../utility/fileUtils.js';
import { writeFile } from 'node:fs/promises';
import { HOST_NAME } from '../config/config.js';
const dirname = import.meta.dirname;
import path from 'path';

import { fileURLToPath } from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));


// Variables ---------------------------------------------------------------------------
Expand All @@ -31,7 +34,7 @@ const PATH_TO_CONTRIBUTORS_FILE = '../../../database/contributors.json';
}
*/
let contributors = (() => {
const fileIfExists = readFileIfExists(join(dirname, PATH_TO_CONTRIBUTORS_FILE));
const fileIfExists = readFileIfExists(join(__dirname, PATH_TO_CONTRIBUTORS_FILE));
if (fileIfExists) return JSON.parse(fileIfExists);
return [];
})();
Expand Down

0 comments on commit e3a950f

Please sign in to comment.