improve path processing
This commit is contained in:
parent
e07f0fa6e3
commit
5329537a2f
@ -23,6 +23,7 @@ type App struct {
|
||||
ctx context.Context
|
||||
HasConfigData bool
|
||||
ConfigData map[string]any
|
||||
Dev bool
|
||||
exDir string
|
||||
cmdPrefix string
|
||||
}
|
||||
@ -48,8 +49,12 @@ func (a *App) OnStartup(ctx context.Context) {
|
||||
a.exDir = filepath.Dir(ex) + "/"
|
||||
a.cmdPrefix = "cd " + a.exDir + " && "
|
||||
}
|
||||
if a.Dev {
|
||||
a.exDir = ""
|
||||
} else {
|
||||
os.Chdir(a.exDir)
|
||||
}
|
||||
}
|
||||
|
||||
os.Chmod(a.exDir+"backend-rust/webgpu_server", 0777)
|
||||
os.Chmod(a.exDir+"backend-rust/web-rwkv-converter", 0777)
|
||||
|
12
main.go
12
main.go
@ -67,9 +67,12 @@ var midiAssets embed.FS
|
||||
var components embed.FS
|
||||
|
||||
func main() {
|
||||
dev := true
|
||||
// Create an instance of the app structure
|
||||
app := backend.NewApp()
|
||||
app.Dev = true
|
||||
|
||||
if buildInfo, ok := debug.ReadBuildInfo(); !ok || strings.Contains(buildInfo.String(), "-ldflags") {
|
||||
dev = false
|
||||
app.Dev = false
|
||||
|
||||
backend.CopyEmbed(assets)
|
||||
os.RemoveAll("./py310/Lib/site-packages/cyac-1.7.dist-info")
|
||||
@ -83,9 +86,6 @@ func main() {
|
||||
backend.CopyEmbed(components)
|
||||
}
|
||||
|
||||
// Create an instance of the app structure
|
||||
app := backend.NewApp()
|
||||
|
||||
var zoomFactor float64 = 1.0
|
||||
data, err := app.ReadJson("config.json")
|
||||
if err == nil {
|
||||
@ -99,7 +99,7 @@ func main() {
|
||||
}
|
||||
|
||||
var logger wailsLogger.Logger
|
||||
if dev {
|
||||
if app.Dev {
|
||||
logger = wailsLogger.NewDefaultLogger()
|
||||
} else {
|
||||
logger = wailsLogger.NewFileLogger("crash.log")
|
||||
|
Loading…
Reference in New Issue
Block a user