1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- System.register(["cc"], function (_export, _context) {
- "use strict";
- var _cclegacy, PathUtil, _crd;
- _export("default", void 0);
- return {
- setters: [function (_cc) {
- _cclegacy = _cc.cclegacy;
- }],
- execute: function () {
- _crd = true;
- _cclegacy._RF.push({}, "599009CYiRPSbP+6MJkFWLY", "PathUtil", undefined);
- _export("default", PathUtil = class PathUtil {
- /**
- * 返回 Path 的扩展名
- * @param path 路径
- * @returns {string}
- */
- static extname(path) {
- var temp = /(\.[^\.\/\?\\]*)(\?.*)?$/.exec(path);
- return temp ? temp[1] : '';
- }
- /**
- * 获取文件路径的文件名。
- * @param path 路径
- * @param extname 扩展名
- * @returns {string}
- */
- static basename(path, extname) {
- let index = path.indexOf("?");
- if (index > 0) path = path.substring(0, index);
- let reg = /(\/|\\)([^\/\\]+)$/g;
- let result = reg.exec(path.replace(/(\/|\\)$/, ""));
- if (!result) return path;
- let baseName = result[2];
- if (extname && path.substring(path.length - extname.length).toLowerCase() === extname.toLowerCase()) return baseName.substring(0, baseName.length - extname.length);
- return baseName;
- }
- /**
- * 获取文件路径的目录名
- * @param path 路径
- * @returns {string}
- */
- static dirname(path) {
- var temp = /((.*)(\/|\\|\\\\))?(.*?\..*$)?/.exec(path);
- return temp ? temp[2] : '';
- }
- });
- _cclegacy._RF.pop();
- _crd = false;
- }
- };
- });
- //# sourceMappingURL=7787e2fe5a6579c5e061f84c294bcb1203d69d1d.js.map
|