Skip to content

[WE-168] Dependency rework #267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
substitute path with filepath for calculating os dependant paths
  • Loading branch information
Roberto Sora committed Nov 27, 2018
commit f35b2b764d6cd5857d59ec05fc8ad761a76d489b
12 changes: 6 additions & 6 deletions tools/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ func pathExists(path string) bool {
// if it already exists.
func (t *Tools) Download(pack, name, version, behaviour string) error {

index_file := path.Join(t.Directory, "package_index.json")
signature_file := path.Join(t.Directory, "package_index.json.sig")
index_file := filepath.Join(t.Directory, "package_index.json")
signature_file := filepath.Join(t.Directory, "package_index.json.sig")

if _, err := os.Stat(path.Join(t.Directory, "package_index.json")); err != nil || time.Since(t.LastRefresh) > 1*time.Hour {
if _, err := os.Stat(filepath.Join(t.Directory, "package_index.json")); err != nil || time.Since(t.LastRefresh) > 1*time.Hour {
// Download the file again and save it
err = t.DownloadPackageIndex(index_file, signature_file)
if err != nil {
Expand Down Expand Up @@ -225,9 +225,9 @@ func (t *Tools) Download(pack, name, version, behaviour string) error {
}

// Decompress
t.Logger("Unpacking tool " + name)

location := path.Join(dir(), pack, correctTool.Name, correctTool.Version)
t.Logger("Unpacking tool " + name + " in location: "+location)
err = os.RemoveAll(location)

if err != nil {
Expand Down Expand Up @@ -601,14 +601,14 @@ func (t *Tools) installDrivers(location string) error {
}

func makeExecutable(location string) error {
location = path.Join(location, "bin")
location = filepath.Join(location, "bin")
files, err := ioutil.ReadDir(location)
if err != nil {
return err
}

for _, file := range files {
err = os.Chmod(path.Join(location, file.Name()), 0755)
err = os.Chmod(filepath.Join(location, file.Name()), 0755)
if err != nil {
return err
}
Expand Down