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

Function getAbsoluteFilePath

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

Source from the content-addressed store, hash-verified

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

Callers 1

goFunction · 0.85

Calls 2

isDirectoryMethod · 0.80
resolveMethod · 0.45

Tested by

no test coverage detected