mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 19:01:02 +08:00
* [#3133] SingleInstanceData: Fill missing WD as is * Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Fix: missing `import` for AI suggestions * Add changelog entry --------- Co-authored-by: Lea Anthony <lea.anthony@gmail.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
parent
f1265c527e
commit
f7c19469a7
@ -7,6 +7,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/godbus/dbus/v5"
|
"github.com/godbus/dbus/v5"
|
||||||
"github.com/wailsapp/wails/v2/pkg/options"
|
"github.com/wailsapp/wails/v2/pkg/options"
|
||||||
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@ -55,8 +56,15 @@ func SetupSingleInstance(uniqueID string) {
|
|||||||
data := options.SecondInstanceData{
|
data := options.SecondInstanceData{
|
||||||
Args: os.Args[1:],
|
Args: os.Args[1:],
|
||||||
}
|
}
|
||||||
|
data.WorkingDirectory, err = os.Getwd()
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed to get working directory: %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
serialized, err := json.Marshal(data)
|
serialized, err := json.Marshal(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Printf("Failed to marshal data: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/wailsapp/wails/v2/internal/frontend/desktop/windows/winc/w32"
|
"github.com/wailsapp/wails/v2/internal/frontend/desktop/windows/winc/w32"
|
||||||
"github.com/wailsapp/wails/v2/pkg/options"
|
"github.com/wailsapp/wails/v2/pkg/options"
|
||||||
"golang.org/x/sys/windows"
|
"golang.org/x/sys/windows"
|
||||||
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
@ -51,7 +52,16 @@ func SetupSingleInstance(uniqueId string) {
|
|||||||
data := options.SecondInstanceData{
|
data := options.SecondInstanceData{
|
||||||
Args: os.Args[1:],
|
Args: os.Args[1:],
|
||||||
}
|
}
|
||||||
serialized, _ := json.Marshal(data)
|
data.WorkingDirectory, err = os.Getwd()
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed to get working directory: %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
serialized, err := json.Marshal(data)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Failed to marshal data: %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
SendMessage(hwnd, string(serialized))
|
SendMessage(hwnd, string(serialized))
|
||||||
// exit second instance of app after sending message
|
// exit second instance of app after sending message
|
||||||
|
@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Fixed
|
### Fixed
|
||||||
- Docs for IsZoomControlEnabled and ZoomFactor. Fixed by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/3137)
|
- Docs for IsZoomControlEnabled and ZoomFactor. Fixed by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/3137)
|
||||||
- Fixed `-compiler` flag for `wails build`, `wails dev` and `wails generate module`. Fixed in [PR](https://github.com/wailsapp/wails/pull/3121) by [@xtrafrancyz](https://github.com/xtrafrancyz)
|
- Fixed `-compiler` flag for `wails build`, `wails dev` and `wails generate module`. Fixed in [PR](https://github.com/wailsapp/wails/pull/3121) by [@xtrafrancyz](https://github.com/xtrafrancyz)
|
||||||
|
- Fixed uninitialized `SecondInstanceData.WorkingDirectory` on linux and windows ([#3154](https://github.com/wailsapp/wails/pull/3154)).
|
||||||
|
|
||||||
## v2.7.1 - 2023-12-10
|
## v2.7.1 - 2023-12-10
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user