mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-04 12:25:19 -04:00
Projectpath error message (#274)
* Improve error message * Improve error message
This commit is contained in:
parent
2fc01a1db4
commit
b66dffbf92
BIN
dist/index.js
generated
vendored
BIN
dist/index.js
generated
vendored
Binary file not shown.
BIN
dist/index.js.map
generated
vendored
BIN
dist/index.js.map
generated
vendored
Binary file not shown.
@ -14,8 +14,8 @@ describe('Unity Versioning', () => {
|
||||
});
|
||||
|
||||
describe('read', () => {
|
||||
it('does not throw', () => {
|
||||
expect(() => UnityVersioning.read('')).not.toThrow();
|
||||
it('throws for invalid path', () => {
|
||||
expect(() => UnityVersioning.read('')).toThrow(Error);
|
||||
});
|
||||
|
||||
it('reads from test-project', () => {
|
||||
|
@ -1,4 +1,3 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
@ -17,8 +16,7 @@ export default class UnityVersioning {
|
||||
static read(projectPath) {
|
||||
const filePath = path.join(projectPath, 'ProjectSettings', 'ProjectVersion.txt');
|
||||
if (!fs.existsSync(filePath)) {
|
||||
core.warning(`Could not find "${filePath}", keeping unityVersion as "auto"`);
|
||||
return 'auto';
|
||||
throw new Error(`Project settings file not found at "${filePath}". Have you correctly set the projectPath?`);
|
||||
}
|
||||
return UnityVersioning.parse(fs.readFileSync(filePath, 'utf8'));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user