more (untested) windows bugfixes
This commit is contained in:
parent
94fc08b2b1
commit
80a07f768d
|
@ -2,7 +2,16 @@
|
||||||
|
|
||||||
package platform
|
package platform
|
||||||
|
|
||||||
|
import(
|
||||||
|
"path"
|
||||||
|
)
|
||||||
|
|
||||||
func SanitiseFilename(filename string) (newName string, e error) {
|
func SanitiseFilename(filename string) (newName string, e error) {
|
||||||
newName = filename
|
newName = filename
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func DirOf(filename string) (dirname string, e error) {
|
||||||
|
dirname = path.Dir(filename)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
|
@ -15,3 +15,13 @@ func SanitiseFilename(filename string) (newName string, e error) {
|
||||||
newName = r.ReplaceAllString(filename, "")
|
newName = r.ReplaceAllString(filename, "")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func DirOf(filename string) (dirname string, e error) {
|
||||||
|
r, e := regexp.Compile(`[^\ ]+$`)
|
||||||
|
if e != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dirname = r.ReplaceAllString(filename, "")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
|
@ -30,7 +30,11 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
exe, _ := os.Executable()
|
exe, _ := os.Executable()
|
||||||
wDir := path.Dir(exe)
|
wDir, e := platform.DirOf(exe)
|
||||||
|
if e != nil {
|
||||||
|
panic(e)
|
||||||
|
}
|
||||||
|
|
||||||
magicData, e := ioutil.ReadFile(wDir + "/magic.json")
|
magicData, e := ioutil.ReadFile(wDir + "/magic.json")
|
||||||
if e != nil {
|
if e != nil {
|
||||||
panic(e)
|
panic(e)
|
||||||
|
|
Loading…
Reference in New Issue