@keymanapp/kmc
Version:
Keyman Developer compiler command line tools
22 lines (20 loc) • 1.05 kB
JavaScript
/**
* This is a helper function to derive the relative path within the
* @keymanapp/keyboards or @keymanapp/lexical-models repository, given a .kpj
* project filename. Handles \ vs /. Must be a project filename, not a project
* folder.
*
* For example, given "c/path/to/keyboards/release/k/keyboard/keyboard.kpj, we
* want "release/k/keyboard".
*/
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="98af1c13-c781-5917-b25b-03483719a85a")}catch(e){}}();
export function calculateSourcePath(projectFilename) {
projectFilename = projectFilename.replace(/\\/g, '/');
const result = /(release|legacy|experimental)\/([^\/]+)\/([^\/]+)\/([^\/]+)\.kpj$/.exec(projectFilename);
if (!result) {
return undefined;
}
return `${result[1]}/${result[2]}/${result[3]}`;
}
//# sourceMappingURL=calculateSourcePath.js.map
//# debugId=98af1c13-c781-5917-b25b-03483719a85a