diff --git a/app.go b/app.go index 687ca80..142df3d 100644 --- a/app.go +++ b/app.go @@ -61,7 +61,7 @@ func (a *App) StartServer(s string) string { runtime.LogInfo(a.ctx, s) var server Server if err := json.Unmarshal([]byte(s), &server); err != nil { - runtime.LogInfo(a.ctx, err.Error()) + runtime.LogError(a.ctx, err.Error()) } runtime.LogInfo(a.ctx, fmt.Sprintf("server: %v", server)) @@ -71,3 +71,24 @@ func (a *App) StartServer(s string) string { return "starting server" } + +func (a *App) Weed() { + os.Chdir("d:\\projects\\sw4-nano\\util") + //s := subprocess.New(".\\"+name+".exe") + cmd := "py scanpics.py" + s := subprocess.New(cmd) + err := s.Exec() + if err != nil { + runtime.LogError(a.ctx, err.Error()) + } + runtime.LogInfo(a.ctx, fmt.Sprintf("команда выполнена успешно")) +} + +func (a *App) GetStatus() string { + pics, err := os.ReadDir("d:\\pics") + if err != nil { + runtime.LogError(a.ctx, err.Error()) + return "error: " + err.Error() + } + return fmt.Sprint(len(pics)) +} diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte index 1a39684..60eb6bd 100644 --- a/frontend/src/App.svelte +++ b/frontend/src/App.svelte @@ -1,17 +1,14 @@ - + СЕРВЕРА - {#each servers as server} + {#each local as server} start_server(server)} > {server.name} - {server.run} + + {server.run} + {/each} - + + + + + + УТИЛИТЫ + + + Загрузка в weed + + + + + {cnt_pic} + + + + diff --git a/frontend/src/servers.js b/frontend/src/servers.js index 1fd0df4..d8aa01b 100644 --- a/frontend/src/servers.js +++ b/frontend/src/servers.js @@ -27,6 +27,13 @@ const servers = [ port: "4323", run: "idle" }, + { + name: "sw4-nano", + dir: "d:\\projects\\sw4-nano", + cmd: ".\\sw4-nano.exe", + port: "4321", + run: "idle" + }, ]; export default servers; \ No newline at end of file diff --git a/frontend/wailsjs/go/main/App.d.ts b/frontend/wailsjs/go/main/App.d.ts index 9d7b500..b012bda 100644 --- a/frontend/wailsjs/go/main/App.d.ts +++ b/frontend/wailsjs/go/main/App.d.ts @@ -1,6 +1,10 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT +export function GetStatus():Promise; + export function Greet(arg1:string):Promise; export function StartServer(arg1:string):Promise; + +export function Weed():Promise; diff --git a/frontend/wailsjs/go/main/App.js b/frontend/wailsjs/go/main/App.js index ee3e2b1..cdb0333 100644 --- a/frontend/wailsjs/go/main/App.js +++ b/frontend/wailsjs/go/main/App.js @@ -2,6 +2,10 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT +export function GetStatus() { + return window['go']['main']['App']['GetStatus'](); +} + export function Greet(arg1) { return window['go']['main']['App']['Greet'](arg1); } @@ -9,3 +13,7 @@ export function Greet(arg1) { export function StartServer(arg1) { return window['go']['main']['App']['StartServer'](arg1); } + +export function Weed() { + return window['go']['main']['App']['Weed'](); +}