bpms_site/.svn/pristine/ef/ef1a47ec2c26c60a635d285e4d9c5d98a52bfc1c.svn-base
2025-11-02 16:38:49 +03:30

19 lines
600 B
Plaintext

/**
* Get pathname from absolute path.
*
* @param absolutePath the absolute path
* @returns the pathname
*/ export function getPathnameFromAbsolutePath(absolutePath) {
// Remove prefix including app dir
let appDir = "/app/";
if (!absolutePath.includes(appDir)) {
appDir = "\\app\\";
}
const [, ...parts] = absolutePath.split(appDir);
const relativePath = appDir[0] + parts.join(appDir);
// remove extension
const pathname = relativePath.split(".").slice(0, -1).join(".");
return pathname;
}
//# sourceMappingURL=get-pathname-from-absolute-path.js.map