decord/stable/source/utils/PathUtils.tsx
github-actions 57c2214117 chore: update source for stable 347.12
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4973.js (118.4 MB)
2026-09-29 21:26:22 +00:00

45 lines
1.2 KiB
TypeScript

// Module ID: 14290
// Function ID: 14291
// Name: PathUtils
// Dependencies: [1364, 2]
// Exports: pathBasename, pathFilenameWithoutExt, pathJoin
// Module 14290 (PathUtils)
import size from "module_2" /* 2 */;
const result = size.fileFinishedImporting("utils/PathUtils.tsx");
export const pathJoin = function pathJoin() {
const items = [...arguments];
let str = "/";
if (obj.isWindows()) {
str = "\\";
}
const found = items.filter((item) => item.length > 0);
return found.join(str);
};
export const pathBasename = function pathBasename(str, arg1) {
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;
};
export const pathFilenameWithoutExt = function pathFilenameWithoutExt(str) {
let arr = str;
const parts = str.split(/[/\\]/);
if ("" !== parts[parts.length - 1]) {
arr = parts[parts.length - 1];
}
const lastIndexOfResult = arr.lastIndexOf(".");
let substr = arr;
if (lastIndexOfResult > 0) {
substr = arr.slice(0, lastIndexOfResult);
}
return substr;
};