view api/server/ui/absolute-path.js @ 213:2fad2931a5a6

Fix for [issue78] gemma back end broken for me since 213:3d0988d9f867 During unification of the two connection pool implementions forget to initialize the tokens -> connection mapping in the non-persistent case.
author Sascha L. Teichmann <teichmann@intevation.de>
date Mon, 23 Jul 2018 20:38:40 +0200
parents 9fcfccb18b16
children
line wrap: on
line source

/*
 * 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