Skip to content

Commit

Permalink
feat: Linux binary search order
Browse files Browse the repository at this point in the history
  • Loading branch information
creamlike1024 committed Jan 7, 2025
1 parent fe5f12f commit 5a6a3ce
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ Connect your card reader before running.

**[estk.me User](https://www.estk.me/)**: If you are using the ACR38U card reader included with estk card and are currently using **macOS 14 Sonoma**, please install the [card reader driver](https://www.acs.com.hk/en/driver/228/acr38u-nd-pocketmate-smart-card-reader-micro-usb/) first

Linux release does not include lpac binary, you need to [compile lpac](https://github.com/estkme-group/lpac?tab=readme-ov-file#compile) by yourself. The lpac binary file should be placed in the same directory as the EasyLPAC binary file
## Linux

lpac binary search order: First, search in the same directory as EasyLPAC. If not found, use `/usr/bin/lpac`

`EasyLPAC-linux-x86_64-with-lpac.tar.gz` contain prebuilt lpac binary, if you can't run it, you need to install `lpac` by package manager or [compile lpac](https://github.com/estkme-group/lpac?tab=readme-ov-file#compile) by yourself.

Note: Reading LPA activation code and QRCode from clipboard not working in Wayland

Expand Down
10 changes: 8 additions & 2 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,21 @@ func LoadConfig() error {
return err
}
exeDir := filepath.Dir(exePath)
ConfigInstance.LpacDir = exeDir

switch platform := runtime.GOOS; platform {
case "windows":
ConfigInstance.EXEName = "lpac.exe"
ConfigInstance.LpacDir = exeDir
ConfigInstance.LogDir = filepath.Join(exeDir, "log")
case "linux":
ConfigInstance.EXEName = "lpac"
ConfigInstance.LogDir = filepath.Join("/tmp", "EasyLPAC-log")
_, err = os.Stat(filepath.Join(ConfigInstance.LpacDir, ConfigInstance.EXEName))
if err != nil {
ConfigInstance.LpacDir = "/usr/bin"
}
default:
ConfigInstance.EXEName = "lpac"
ConfigInstance.LpacDir = exeDir
ConfigInstance.LogDir = filepath.Join("/tmp", "EasyLPAC-log")
}
ConfigInstance.AutoMode = true
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func main() {

_, err = os.Stat(filepath.Join(ConfigInstance.LpacDir, ConfigInstance.EXEName))
if err != nil {
d := dialog.NewError(fmt.Errorf(" lpac not found\nPlease make sure you have put lpac binary in the `lpac` folder"), WMain)
d := dialog.NewError(fmt.Errorf(" lpac not found"), WMain)
d.SetOnClosed(func() {
os.Exit(127)
})
Expand Down

0 comments on commit 5a6a3ce

Please sign in to comment.