From 7a52ddeba2a68388b544f529d2d92104420f77b0 Mon Sep 17 00:00:00 2001 From: Shipwreckt Date: Fri, 31 Oct 2025 20:02:14 +0000 Subject: Changed from static to 11ty! --- .../node-retrieve-globals/util/getWorkingDirectory.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 node_modules/node-retrieve-globals/util/getWorkingDirectory.js (limited to 'node_modules/node-retrieve-globals/util/getWorkingDirectory.js') diff --git a/node_modules/node-retrieve-globals/util/getWorkingDirectory.js b/node_modules/node-retrieve-globals/util/getWorkingDirectory.js new file mode 100644 index 0000000..2231341 --- /dev/null +++ b/node_modules/node-retrieve-globals/util/getWorkingDirectory.js @@ -0,0 +1,18 @@ +import path from "node:path"; +import { pathToFileURL } from "node:url"; + +function addTrailingSlash(path) { + if(path.endsWith("/")) { + return path; + } + return path + "/"; +} + + +function getWorkingDirectory() { + // Trailing slash required + // `import` and `require` should both be relative to working directory (not this file) + return addTrailingSlash(pathToFileURL(path.resolve(".")).toString()); +} + +export { getWorkingDirectory }; \ No newline at end of file -- cgit v1.2.3