Found and addressed some possible path issues
This commit is contained in:
parent
d727f22fe7
commit
be4741895e
|
@ -5,6 +5,7 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -504,6 +505,7 @@ func (c *client) getCurrentPageRawData() (string, error) {
|
||||||
return c.PageState.History[c.PageState.Position].RawContent, nil
|
return c.PageState.History[c.PageState.Position].RawContent, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Saves the specified URL to the specified file path.
|
||||||
func (c *client) saveFile(u Url, name string) {
|
func (c *client) saveFile(u Url, name string) {
|
||||||
var file []byte
|
var file []byte
|
||||||
var err error
|
var err error
|
||||||
|
@ -849,8 +851,7 @@ func (c *client) Visit(url string) {
|
||||||
switch u.Scheme {
|
switch u.Scheme {
|
||||||
case "gopher":
|
case "gopher":
|
||||||
if u.DownloadOnly {
|
if u.DownloadOnly {
|
||||||
nameSplit := strings.Split(u.Resource, "/")
|
filename := path.Base(u.Resource)
|
||||||
filename := nameSplit[len(nameSplit)-1]
|
|
||||||
filename = strings.Trim(filename, " \t\r\n\v\f\a")
|
filename = strings.Trim(filename, " \t\r\n\v\f\a")
|
||||||
if filename == "" {
|
if filename == "" {
|
||||||
filename = "gopherfile"
|
filename = "gopherfile"
|
||||||
|
@ -943,8 +944,7 @@ func (c *client) Visit(url string) {
|
||||||
c.DrawMessage()
|
c.DrawMessage()
|
||||||
c.Draw()
|
c.Draw()
|
||||||
case 'w':
|
case 'w':
|
||||||
nameSplit := strings.Split(u.Resource, "/")
|
filename := path.Base(u.Resource)
|
||||||
filename := nameSplit[len(nameSplit)-1]
|
|
||||||
c.saveFileFromData(capsule.Content, filename)
|
c.saveFileFromData(capsule.Content, filename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1035,7 +1035,6 @@ func (c *client) ReloadPage() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------\\
|
//------------------------------------------------\\
|
||||||
// + + + F U N C T I O N S + + + \\
|
// + + + F U N C T I O N S + + + \\
|
||||||
//--------------------------------------------------\\
|
//--------------------------------------------------\\
|
||||||
|
|
3
main.go
3
main.go
|
@ -23,6 +23,7 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
|
@ -61,7 +62,7 @@ func saveConfig() error {
|
||||||
|
|
||||||
opts.WriteString(certs)
|
opts.WriteString(certs)
|
||||||
|
|
||||||
return ioutil.WriteFile(bombadillo.Options["configlocation"]+"/.bombadillo.ini", []byte(opts.String()), 0644)
|
return ioutil.WriteFile(filepath.Join(bombadillo.Options["configlocation"], ".bombadillo.ini"), []byte(opts.String()), 0644)
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateOpt(opt, val string) bool {
|
func validateOpt(opt, val string) bool {
|
||||||
|
|
Loading…
Reference in New Issue