Added path check for Windows when loading external QML windows/components

This commit is contained in:
Maran 2014-07-09 14:01:53 +02:00
parent 05c1899895
commit c2bca5939d

@ -5,6 +5,7 @@ import (
"github.com/ethereum/eth-go/ethpub" "github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethutil" "github.com/ethereum/eth-go/ethutil"
"github.com/go-qml/qml" "github.com/go-qml/qml"
"runtime"
) )
type QmlApplication struct { type QmlApplication struct {
@ -20,7 +21,14 @@ func NewQmlApplication(path string, lib *UiLib) *QmlApplication {
} }
func (app *QmlApplication) Create() error { func (app *QmlApplication) Create() error {
component, err := app.engine.LoadFile(app.path) path := string(app.path)
// For some reason for windows we get /c:/path/to/something, windows doesn't like the first slash but is fine with the others so we are removing it
if string(app.path[0]) == "/" && runtime.GOOS == "windows" {
path = app.path[1:]
}
component, err := app.engine.LoadFile(path)
if err != nil { if err != nil {
logger.Warnln(err) logger.Warnln(err)
} }