Skip to content

Commit

Permalink
Normalize Windows Paths
Browse files Browse the repository at this point in the history
- Normalized file paths on Windows using `path.win32.normalize` to ensure consistent behavior across platforms.
  • Loading branch information
torikushiii committed Jun 20, 2024
1 parent c0a6e89 commit 2b2d3df
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion commands/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const loadCommands = (async function () {
const { platform } = require("node:os");
const fs = require("node:fs/promises");
const path = require("node:path");

Expand All @@ -13,7 +14,11 @@ const loadCommands = (async function () {
for (const dir of dirList) {
let def;

const defPath = path.join(__dirname, dir.name, "index.js");
let defPath = path.join(__dirname, dir.name, "index.js");
if (platform() === "win32") {
defPath = path.win32.normalize(defPath);
}

try {
def = require(defPath);
}
Expand Down

0 comments on commit 2b2d3df

Please sign in to comment.