Fix assets loading in QML on windows #258
|
@ -79,8 +79,8 @@ pipeline:
|
|||
commands:
|
||||
- export PATH=$PATH:/home/user/work/bin:/media/sf_GOPATH1/bin
|
||||
- apt-get -qq update && apt-get --no-install-recommends -qq -y install ca-certificates curl git zip
|
||||
- rm -r vendor
|
||||
- make clean
|
||||
- rm -r vendor || true
|
||||
- make clean || true
|
||||
- go mod download
|
||||
- export VERSION=`git describe --tags`
|
||||
- export BUILDDATE=`date +%G-%m-%d-%H-%M`
|
||||
|
@ -126,9 +126,10 @@ pipeline:
|
|||
- echo $BUILDFILES_KEY > ~/id_rsab64
|
||||
- base64 -d ~/id_rsab64 > ~/id_rsa
|
||||
- chmod 400 ~/id_rsa
|
||||
- git fetch --tags
|
||||
- export DIR=`date +%G.%m.%d-%H.%M`-`git describe --tags`
|
||||
- cd deploy
|
||||
- mkdir windows_build/$DIR
|
||||
- mkdir -p windows_build/$DIR
|
||||
- mv cwtch* windows_build/$DIR/
|
||||
- scp -r -o StrictHostKeyChecking=no -i ~/id_rsa windows_build buildfiles@openprivacy.ca:/home/buildfiles/buildfiles/
|
||||
notify-email:
|
||||
|
|
12
main.go
12
main.go
|
@ -129,13 +129,17 @@ func mainUi(flagLocal bool, flagClientUI bool) {
|
|||
// our globals
|
||||
gcd := ui.NewGrandCentralDispatcher(nil)
|
||||
gcd.SetOs(runtime.GOOS)
|
||||
ex, err := os.Executable()
|
||||
if err != nil { log.Errorf("error getting path: %v", err) }
|
||||
dir := path.Dir(ex)
|
||||
dir := core.QCoreApplication_ApplicationDirPath()
|
||||
log.Infof("core.QCoreApplication_ApplicationDirPath(): %v\n", dir)
|
||||
if runtime.GOOS == "android" {
|
||||
gcd.SetAssetPath("assets:/")
|
||||
} else {
|
||||
gcd.SetAssetPath("file://" + path.Join(dir, "assets") + string(os.PathSeparator))
|
||||
// all of these access are QML based, and QML takes URIs which use forward slashes and translates them to local OS sperators
|
||||
// also windows paths need to be like /c:/PATH
|
||||
if runtime.GOOS == "windows" {
|
||||
dir = "/" + dir
|
||||
}
|
||||
gcd.SetAssetPath("file://" + path.Join(dir, "assets") + "/")
|
||||
}
|
||||
|
||||
if buildVer != "" {
|
||||
|
|
Reference in New Issue