Check the chosen command for existence

This commit is contained in:
Justin Hawkins 2021-11-21 16:30:57 +10:30
parent 0bfa38fff5
commit 14a35cdd9e
2 changed files with 9 additions and 0 deletions

View File

@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.
## [Unreleased]
- Check the chosen command exists when configuring a profile
## [v0.5.3] - 2021-11-21
- Add config option to limit number of simultaneous downloads

View File

@ -6,6 +6,7 @@ import (
"fmt"
"log"
"os"
"os/exec"
"strings"
"gopkg.in/yaml.v2"
@ -147,6 +148,12 @@ func (c *Config) UpdateFromJSON(j []byte) error {
}
}
// check the command exists
_, err := exec.LookPath(newConfig.DownloadProfiles[i].Command)
if err != nil {
return fmt.Errorf("Could not find %s on the path", newConfig.DownloadProfiles[i].Command)
}
}
*c = newConfig