forked from sloum/bombadillo
Fix using path/filepath Join function
This commit is contained in:
parent
1045829076
commit
60dafcceba
|
@ -5,6 +5,7 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -503,7 +504,8 @@ func (c *client) saveFile(u Url, name string) {
|
||||||
c.DrawMessage()
|
c.DrawMessage()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
savePath := c.Options["savelocation"] + "/" + name
|
|
||||||
|
savePath := filepath.Join(c.Options["savelocation"], name)
|
||||||
err = ioutil.WriteFile(savePath, file, 0644)
|
err = ioutil.WriteFile(savePath, file, 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.SetMessage("Error writing file: "+err.Error(), true)
|
c.SetMessage("Error writing file: "+err.Error(), true)
|
||||||
|
@ -519,10 +521,11 @@ func (c *client) saveFileFromData(d, name string) {
|
||||||
data := []byte(d)
|
data := []byte(d)
|
||||||
c.SetMessage(fmt.Sprintf("Saving %s ...", name), false)
|
c.SetMessage(fmt.Sprintf("Saving %s ...", name), false)
|
||||||
c.DrawMessage()
|
c.DrawMessage()
|
||||||
savePath := c.Options["savelocation"] + name
|
|
||||||
|
savePath := filepath.Join(c.Options["savelocation"], name)
|
||||||
err := ioutil.WriteFile(savePath, data, 0644)
|
err := ioutil.WriteFile(savePath, data, 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.SetMessage("Error writing file to disk", true)
|
c.SetMessage("Error writing file: "+err.Error(), true)
|
||||||
c.DrawMessage()
|
c.DrawMessage()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue