MCPcopy Create free account
hub / github.com/Kong/insomnia / getAbsoluteFilePath

Function getAbsoluteFilePath

packages/insomnia-inso/src/cli.ts:108–121  ·  view source on GitHub ↗
({ workingDir, file }: { workingDir?: string; file: string })

Source from the content-addressed store, hash-verified

106const localAppDir = getAppDataDir(getDefaultProductName());
107
108export const getAbsoluteFilePath = ({ workingDir, file }: { workingDir?: string; file: string }) => {
109 if (!file) {
110 return '';
111 }
112
113 if (workingDir) {
114 if (fs.existsSync(workingDir) && !fs.statSync(workingDir).isDirectory()) {
115 return nodePath.resolve(nodePath.dirname(workingDir), file);
116 }
117 return nodePath.resolve(workingDir, file);
118 }
119
120 return nodePath.resolve(process.cwd(), file);
121};
122export const logErrorAndExit = (err?: Error) => {
123 if (err instanceof InsoError) {
124 logger.fatal(err.message);

Callers 1

goFunction · 0.85

Calls 2

isDirectoryMethod · 0.80
resolveMethod · 0.45

Tested by

no test coverage detected