decord/alpha/source/utils/PathUtils.tsx

46 lines
1.2 KiB
TypeScript
Raw Normal View History

// Module ID: 13732
// Function ID: 13733
// Name: PathUtils
// Dependencies: [1364, 2]
2026-07-29 08:29:29 +00:00
// Exports: pathBasename, pathFilenameWithoutExt, pathJoin
2026-07-20 16:05:17 +00:00
// Module 13732 (PathUtils)
import size from "module_2" /* 2 */;
2026-08-24 06:08:38 +00:00
const result = size.fileFinishedImporting("utils/PathUtils.tsx");
2026-07-29 08:29:29 +00:00
export const pathJoin = function pathJoin() {
2026-07-29 08:29:29 +00:00
const items = [...arguments];
let str = "/";
if (obj.isWindows()) {
str = "\\";
}
const found = items.filter((item) => item.length > 0);
2026-07-29 08:29:29 +00:00
return found.join(str);
};
export const pathBasename = function pathBasename(str, arg1) {
2026-07-20 16:05:17 +00:00
let arr = str;
const parts = str.split(/[/\\]/);
if ("" !== parts[parts.length - 1]) {
arr = parts[parts.length - 1];
}
let substr = arr;
if (tmp) {
substr = arr.slice(0, -arg1.length);
}
return substr;
};
2026-07-29 08:29:29 +00:00
export const pathFilenameWithoutExt = function pathFilenameWithoutExt(str) {
let arr = str;
const parts = str.split(/[/\\]/);
if ("" !== parts[parts.length - 1]) {
arr = parts[parts.length - 1];
}
2026-07-20 16:05:17 +00:00
const lastIndexOfResult = arr.lastIndexOf(".");
let substr = arr;
if (lastIndexOfResult > 0) {
substr = arr.slice(0, lastIndexOfResult);
}
return substr;
};