Skip to content

Commit

Permalink
Optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanZosimov committed Jun 30, 2022
1 parent ccb7da8 commit 099ed89
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
10 changes: 4 additions & 6 deletions dist/setup/index.js
Expand Up @@ -65271,12 +65271,10 @@ function resolveVersionInput() {
}
if (versionFile) {
if (!fs_1.default.existsSync(versionFile)) {
logWarning(`The specified python version file at: ${versionFile} does not exist. Attempting to find .python-version file.`);
if (!fs_1.default.existsSync('.python-version')) {
throw new Error(`The specified python version file at: ${versionFile} does not exist and default .python-version file isn't found.`);
}
else {
versionFile = '.python-version';
logWarning(`The specified python version file at: ${versionFile} doesn't exist. Attempting to find .python-version file.`);
versionFile = '.python-version';
if (!fs_1.default.existsSync(versionFile)) {
throw new Error(`The ${versionFile} doesn't exist.`);
}
}
version = fs_1.default.readFileSync(versionFile, 'utf8');
Expand Down
11 changes: 4 additions & 7 deletions src/setup-python.ts
Expand Up @@ -39,14 +39,11 @@ function resolveVersionInput(): string {
if (versionFile) {
if (!fs.existsSync(versionFile)) {
logWarning(
`The specified python version file at: ${versionFile} does not exist. Attempting to find .python-version file.`
`The specified python version file at: ${versionFile} doesn't exist. Attempting to find .python-version file.`
);
if (!fs.existsSync('.python-version')) {
throw new Error(
`The specified python version file at: ${versionFile} does not exist and default .python-version file isn't found.`
);
} else {
versionFile = '.python-version';
versionFile = '.python-version';
if (!fs.existsSync(versionFile)) {
throw new Error(`The ${versionFile} doesn't exist.`);
}
}

Expand Down

0 comments on commit 099ed89

Please sign in to comment.