Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portable Espanso on Windows does not override installed copy #1975

Open
1 task
stewcam opened this issue May 26, 2024 · 5 comments
Open
1 task

Portable Espanso on Windows does not override installed copy #1975

stewcam opened this issue May 26, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@stewcam
Copy link

stewcam commented May 26, 2024

Description

I have been testing portable mode on a Windows 11 laptop with an installed copy of Espanso 2.2.1. After exit from the installed copy I started a portable copy. However, the running copy of portable Espanso does not override the installed version of espanso. If I open a command prompt (even from the portable Espanso program folder) and type 'espanso path' I still see the installed Espanso paths. Also if I install a package from the hub while running portable Espanso it will install to the default installed location rather than to the portable folder .espanso\match\packages. To resolve this issue it is necessary to uninstall the installed copy of Espanso and then run espanso.cmd from the portable Espanso program folder.

(Originally posted in closed issue: #623 (comment))

Steps to reproduce

Exit installed Espanso (without uninstall) and start portable Espanso. Install a package from the Espanso Hub.

Expected behavior

Packages should install to .espanso\match\packages while portable Espanso is running but instead install to the default installed location.

Screenshots

No response

Logs

No response

Your environment

  • Windows 11 v23H2
  • Espanso version 2.2.1

Self-service

  • I'd be willing to fix this bug myself.
@stewcam stewcam added the bug Something isn't working label May 26, 2024
@stewcam stewcam changed the title Portable Espanso on Windows does not correctly override installed copy Portable Espanso on Windows does not override installed copy May 29, 2024
@stewcam
Copy link
Author

stewcam commented May 29, 2024

With the help of @joh6nn I have worked out that this issue rides on the way in which portable Espanso is started. The following notes are from Windows 11 using Powershell, with portable Espanso in D:\Temp\EspansoPortable.

If I exit installed Espanso and start portable Espanso from the portable folder using 'START_ESPANSO.bat' (as recommended in the portable readme.txt file) and then enter 'espanso path' I get the following response:

Config: C:\Users\Cam\AppData\Roaming\espanso
Packages: C:\Users\Cam\AppData\Roaming\espanso\match\packages
Runtime: C:\Users\Cam\AppData\Local\espanso

If I then install a package using 'espanso install package-name' it goes into the default packages folder for installed Espanso even though portable Espanso is running.

However, if I exit portable Espanso and restart it using '.\espanso.cmd start' followed by '.\espanso.cmd path' I get the following response:

Config: D:\Temp\EspansoPortable\.espanso
Packages: D:\Temp\EspansoPortable\.espanso\match\packages
Runtime: D:\Temp\EspansoPortable\.espanso-runtime

If I then install a package using '.\espanso.cmd install package-name' it goes into the packages folder for portable Espanso as expected.

In summary, this issue is not a bug but it would be a useful enhancement if it was clarified in the readme file and Espanso docs.

@smeech
Copy link
Collaborator

smeech commented May 30, 2024

https://github.com/search?q=repo%3Aespanso%2Fespanso%20start_espanso.bat&type=code appears to show the origin of START_ESPANSO.bat.

Is the code, or the documentation, incorrect?

@stewcam
Copy link
Author

stewcam commented May 30, 2024

@smeech START_ESPANSO.bat is a batch file with the following content:

start espansod.exe launcher

This differs from espanso.cmd which is a command that contains:

@"%~dp0espansod.exe" %*

I can use either to start portable Espanso but the first one picks up paths from the installed copy of Espanso while the second one picks up the expected portable paths. There is a comment at the foot of the README.txt for portable Espanso, which indicates that espanso.cmd handles STD console handles correctly. However, I think most users would take the advice of the top of the file to start espanso by clicking on START_ESPANSO.bat (also advised at https://espanso.org/docs/get-started).

@smeech
Copy link
Collaborator

smeech commented May 30, 2024

Does it make a difference if installed Espanso hasn't been run?
Can anyone comment on why START_ESPANSO.bat might have its current contents (given that we're not likely to hear from Federico).

Do we need to correct the code, or the documentation?

@stewcam
Copy link
Author

stewcam commented May 31, 2024

@smeech It doesn't make a difference if installed Espanso has not been run. It seems that START_ESPANSO.bat defers to the paths set by the installer whereas .\espanso.cmd correctly picks up the portable paths. This comparison holds true while portable Espanso is running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants