From 985683668b7d26d4627a99b15e46d122b09f9563 Mon Sep 17 00:00:00 2001 From: snowgitea Date: Wed, 1 Jul 2026 17:55:19 +0800 Subject: [PATCH] chore: public/swagger/absolute-path.js --- public/swagger/absolute-path.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 public/swagger/absolute-path.js diff --git a/public/swagger/absolute-path.js b/public/swagger/absolute-path.js new file mode 100644 index 0000000..af42bc8 --- /dev/null +++ b/public/swagger/absolute-path.js @@ -0,0 +1,14 @@ +/* + * getAbsoluteFSPath + * @return {string} When run in NodeJS env, returns the absolute path to the current directory + * When run outside of NodeJS, will return an error message + */ +const getAbsoluteFSPath = function () { + // detect whether we are running in a browser or nodejs + if (typeof module !== "undefined" && module.exports) { + return require("path").resolve(__dirname) + } + throw new Error('getAbsoluteFSPath can only be called within a Nodejs environment'); +} + +module.exports = getAbsoluteFSPath