sciter-sdk / go-sciter

Golang bindings of Sciter: the Embeddable HTML/CSS/script engine for modern UI development
https://sciter.com
2.58k stars 268 forks source link

Path bug? #190

Open edk24 opened 5 years ago

edk24 commented 5 years ago

debug No problem.

w.LoadFile("demo9.html")`
w.LoadFile("./demo9.html")

if go build demo9.go Cannot load File

w.LoadFile(GetCurrentDirectory() + "/demo9.html")  // OK

PC: Linux/deepin

Sorry, I can't speak English. I hope you can understand my expression.

pravic commented 5 years ago

w.LoadFile("demo9.html")`

HTML paths should be absolute.

w.LoadFile(GetCurrentDirectory() + "/demo9.html")

This should be okay unless you change current directory. Better use executable path:

https://stackoverflow.com/questions/18537257/how-to-get-the-directory-of-the-currently-running-file https://stackoverflow.com/questions/12090170/find-the-path-to-the-executable

ffred commented 5 years ago

that's something that as been introduced in a recent Sciter SDK (at least since the last time I tried Sciter). so most of the examples are not working directly now. not a big deal to solve, but a message on the front readme page about it would be nice for newcomers...

pravic commented 5 years ago

I'll check that, thanks for the notice.

JerryKwan commented 5 years ago

Yes, i encountered this problem too, it was caused by recent Sciter SDK.

jiqi136 commented 5 years ago

Don't use w.LoadFile(), don't use w.LoadFile(), don't use w.LoadFile(). The important thing, say three times.

My code:

`Var page source code html = mold all read files ("layout design.html")// ioutil.ReadFile()

//var page source code html = mold one page source code () / / source code html directly embedded in main.go

/ / Load html, from a string variable w.LoadHtml (page source code html, "")`


不要用w.LoadFile(),不要用w.LoadFile(),不要用w.LoadFile()。 重要的事,说三遍。

我的代码:

` var 页面源代码html = 模具一一全部读取文件("布局设计.html") //GO的 ioutil.ReadFile()

//var 页面源代码html = 模具一一页面源代码()// 源代码html直接 嵌入 main.go中

//加载html,从一个字符串变量中 界面窗口.LoadHtml(页面源代码html, "")`