use posix path

This commit is contained in:
codetypes committed 2024-12-04 22:54:46 +08:00
1 parent 041b793f20
commit e6a44d8f39
3 files changed
+11 -7

No files matched your search

+7 -3
View File
@@ -5,12 +5,16 @@ const Path = path;
declare module "path" {
interface PlatformPath {
basenameWithoutExt(path: string): string;
posixPath(path: string): string;
}
}
// eslint-disable-next-line @typescript-eslint/no-shadow
path.basenameWithoutExt = (path: string) => {
return Path.basename(path, Path.extname(path));
path.basenameWithoutExt = (str: string) => {
return Path.basename(str, Path.extname(str));
};
path.posixPath = (str: string) => {
return path.normalize(str).replace(/\\/g, "/");
};
export default Path;