Use capture group to find Unity version to support new 6000 versions (#639)
This commit is contained in:
12
dist/index.js
generated
vendored
12
dist/index.js
generated
vendored
@@ -7757,9 +7757,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
const node_fs_1 = __importDefault(__nccwpck_require__(87561));
|
||||
const node_path_1 = __importDefault(__nccwpck_require__(49411));
|
||||
class UnityVersioning {
|
||||
static get versionPattern() {
|
||||
return /20\d{2}\.\d\.\w{3,4}|3/;
|
||||
}
|
||||
static determineUnityVersion(projectPath, unityVersion) {
|
||||
if (unityVersion === 'auto') {
|
||||
return UnityVersioning.read(projectPath);
|
||||
@@ -7774,11 +7771,12 @@ class UnityVersioning {
|
||||
return UnityVersioning.parse(node_fs_1.default.readFileSync(filePath, 'utf8'));
|
||||
}
|
||||
static parse(projectVersionTxt) {
|
||||
const matches = projectVersionTxt.match(UnityVersioning.versionPattern);
|
||||
if (!matches || matches.length === 0) {
|
||||
throw new Error(`Failed to parse version from "${projectVersionTxt}".`);
|
||||
const versionRegex = /m_EditorVersion: (\d+\.\d+\.\d+[A-Za-z]?\d+)/;
|
||||
const matches = projectVersionTxt.match(versionRegex);
|
||||
if (!matches || matches.length < 2) {
|
||||
throw new Error(`Failed to extract version from "${projectVersionTxt}".`);
|
||||
}
|
||||
return matches[0];
|
||||
return matches[1];
|
||||
}
|
||||
}
|
||||
exports["default"] = UnityVersioning;
|
||||
|
||||
Reference in New Issue
Block a user