Bottles icon indicating copy to clipboard operation
Bottles copied to clipboard

Improve .lnk finder/parser

Open Docmine17 opened this issue 2 years ago • 6 comments

Describe the bug Bottles does not correctly add the .lnk files in the "programs" tab, as you can see in the image below there are 4 "BF2" (the correct thing was to have Battlefield 2, Battlefield 2: Special Forces, BF2ALL64 and BF2SP64) if you open each one of them, they only open standard BF2.exe, DLCs/mods don't work, because the battlefield only opens DLCs/mods if the arguments are at the time of executing the file, and these arguments are present in the .lnk files.

Screenshot of 2022-01-08 20-18-39

As you can see the last shortcuts that are underlined, I manually added using the " + " button these shortcuts were at: com.usebottles.bottles/data/bottles/bottles/BF2/drive_c/users/gabriel/Desktop and com.usebottles.bottles/data/bottles/bottles/BF2/drive_c/ProgramData/Microsoft/Windows/Start Menu/Programs/Battlefield 2 manually added shortcuts work exactly as they should.

===== Installed directly using Wine: Screenshot of 2022-01-08 19-44-56

By installing directly, each shortcut works exactly as it should.

Installation

  • Method: Flatpak
  • Version 2021.12.28-treviso

To Reproduce Steps to reproduce the behavior:

  1. Create a bottle
  2. install battlefield 2 complete edition
  3. run bf2 on programs

Expected behavior Display "Battlefield 2, Battlefield 2: Special Forces, BF2ALL64 and BF2SP64" in the programs tab, and when running them, each version of the game, whether dlc or mod, will run.

Desktop (please complete the following information):

  • OS:Ubuntu.
  • Version 21.10
  • Display server: Xorg Additional info Ignoring the above problem, the game works fine. It would be interesting an option to remove programs (not uninstall them) and another to add icon in menu/desktop. ====== I'm using google translator, my english is bad. 👀 ====== Thank you very much, your program is very good.👌

Docmine17 avatar Jan 09 '22 00:01 Docmine17

Hi thanks for reporting.

Duplicates have already been fixed in 2022.1.14. Bottles monitors some paths to find files, maybe Desktop is not among those and I can add it.

At the moment it is not possible to delete the automatically detected programs, I don't know if I can schedule it for the next version.

mirkobrombin avatar Jan 09 '22 07:01 mirkobrombin

Using version 2022.1.14-trento there are not 4 "BF2", however the shortcut still doesn't have the correct name: "Battlefield 2", and as I said in the first post the 4 shortcuts were to start each mod/dlc of the game. Screenshot of 2022-01-14 20-35-24

But if I add these shortcuts using the " + " button: com.usebottles.bottles/data/bottles/bottles/Battle/drive_c/ProgramData/Microsoft/Windows/Start Menu/Programs/Battlefield 2/Battlefield 2.lnk

com.usebottles.bottles/data/bottles/bottles/Battle/drive_c/ProgramData/Microsoft/Windows/Start Menu/Programs/Battlefield 2/Special Forces.lnk

Their names, and execution arguments are added correctly:

Screenshot of 2022-01-14 20-50-11

opening the files. lnk using wine notepad this is displayed: Battlefield 2.lnk L À F³ ï àOÐ ê:i¢Ø +00 #C:\ 6 1 .T@º Games " .T@º.T@º G a m e s N 1 .TY» Battlefield 2 2 .TY».TY» B a t t l e f i e l d 2 < 2 BF2.exe & B F 2 . e x e M - L C C:\Games\Battlefield 2\BF2.exe C : \ G a m e s \ B a t t l e f i e l d 2 + m e n u 1 + f u l l s c r e e n 1 Special Forces.lnk L À Fó ï àOÐ ê:i¢Ø +00 #C:\ 6 1 .T@º Games " .T@º.T[» G a m e s N 1 .TY» Battlefield 2 2 .TY».T[» B a t t l e f i e l d 2 < 2 BF2.exe & B F 2 . e x e M - L C C:\Games\Battlefield 2\BF2.exe C : \ G a m e s \ B a t t l e f i e l d 2 ; + m e n u 1 + f u l l s c r e e n 1 + m o d P a t h m o d s / x p a c k + i g n o r e A s s e r t s 1 / C : \ G a m e s \ B a t t l e f i e l d 2 \ m o d s \ x p a c k \ B F 2 x p a c k . i c o Apparently there is a problem with the function of adding programs automatically in the Programs tab, because adding manually using the " + " button the programs are correctly added with their title and execution arguments.

With Notepad++ the problem is the same however the difference is the title only: Screenshot from 2022-01-14 21-05-19

I don't know if this problem only happens to me.

Docmine17 avatar Jan 15 '22 00:01 Docmine17

Bottles try to parse the lnk file to get the executable path but is not able to get the title, so it use the file one

mirkobrombin avatar Jan 15 '22 06:01 mirkobrombin

@Docmine17 Bottles uses the .exe filename as the title. Those variations of Battlefield 2 are all launched via bf2.exe. So unfortunately this is how it is.

Bottles would have to extract the title from the Windows .lnk file but this may be hard.

Arcitec avatar Jan 21 '22 17:01 Arcitec

@mirkobrombin https://pypi.org/project/pylnk/

This may be useful as a reference. It can't be used as-is since it was written for Python 2 and won't run at all on Python 3. But perhaps it gives some code for how to reliably read the title of lnk files.

Arcitec avatar Jan 21 '22 17:01 Arcitec

Ik that project and I’m evaluating an implementation. The coming Bottles release has a new wine backend which is very easy to extend. I’m looking for a better way to fetch programs and parse lnk files (without magic, pylnk or like Bottles does right now).

mirkobrombin avatar Jan 21 '22 23:01 mirkobrombin