添加filesystem
This commit is contained in:
18
packages/filesystem/utils.ts
Normal file
18
packages/filesystem/utils.ts
Normal file
@ -0,0 +1,18 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
|
||||
export function joinPath(...paths: string[]): string {
|
||||
let path = "";
|
||||
paths.forEach((value) => {
|
||||
if (!value) {
|
||||
return;
|
||||
}
|
||||
if (!value.startsWith("/")) {
|
||||
value = `/${value}`;
|
||||
}
|
||||
if (value.endsWith("/")) {
|
||||
value = value.substring(0, value.length - 1);
|
||||
}
|
||||
path += value;
|
||||
});
|
||||
return path;
|
||||
}
|
Reference in New Issue
Block a user