ColinPitrat / caprice32

An emulator of the Amstrad CPC 8bit home computer range.
GNU General Public License v2.0
147 stars 32 forks source link

Linux snap app command line path with space issue #232

Closed anonyme-x22 closed 1 year ago

anonyme-x22 commented 1 year ago

Hi,

I would like to open a .dsk which contains space in its name. Tried with quote don't works?

Thanks in advance, Have a good day, Rgds,

ColinPitrat commented 1 year ago

Can you please provide more details? What command are you running? You mention snap app, where does it come from?

anonyme-x22 commented 1 year ago

Hi, yes of course:

Version 4.5 Latest/stable channel From discover app downloader author: stan michalski

Command line: Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/caprice32_launcher.desktop /snap/bin/caprice32.launcher

Tested: Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/caprice32_launcher.desktop /snap/bin/caprice32.launcher /xxx/inertie.dsk OK Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/caprice32_launcher.desktop /snap/bin/caprice32.launcher "/xxx/Inertie (1987)(Ubi Soft)(fr)(Disk 1 of 2).dsk" KO

Thanks in advance, Have a good day, Rgds,

ColinPitrat commented 1 year ago

Thanks. That's not part of caprice32 project, it's a user contributed snap: https://snapcraft.io/caprice32

You could try the "Contact Stan MICHALSKI" link.

Before that, you may want to dig a bit more to have more details to provide.

When you say KO, what's happening? Is there an error message in the console?

anonyme-x22 commented 1 year ago

Hi,

On linux it's terrible about the snap support they are always outside the main one. I will try, but i doubt to get a better answer than in the main support i think he just compiled the latest stable , made a snap package on discover and that's all... Anyway here is the requested information: terminal launch: env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/caprice32_launcher.desktop /snap/bin/caprice32.launcher "/media/phase_lot/Jeux Consol/Amstrad Cpc/Inertie (1987)(Ubi Soft)(fr)(Disk 1 of 2).dsk" Result: ERROR src/slotshandler.cpp:624 - File not found: 2).dsk

Have always the same result unless i remove all space from the path, and the file.

Thanks in advance, Have a good day, Rgds,

christopheNan commented 1 year ago

Hello, What about replacing double quotes (") by single quotes (')?

ColinPitrat commented 1 year ago

I think the issue is that the argument are forwarded somehow, without being quoted (e.g. caprice32.launcher is a shell script which then calls cap32).

If this is the case, you would have to double the quotes, or mix quotes and single quotes.

For example:

env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/caprice32_launcher.desktop /snap/bin/caprice32.launcher "\"/media/phase_lot/Jeux Consol/Amstrad Cpc/Inertie (1987)(Ubi Soft)(fr)(Disk 1 of 2).dsk\""

Or with single quotes to avoid the escaping:

env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/caprice32_launcher.desktop /snap/bin/caprice32.launcher '"/media/phase_lot/Jeux Consol/Amstrad Cpc/Inertie (1987)(Ubi Soft)(fr)(Disk 1 of 2).dsk"'

If it still doesn't work, you may need another level of quotes:

env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/caprice32_launcher.desktop /snap/bin/caprice32.launcher '"\"/media/phase_lot/Jeux Consol/Amstrad Cpc/Inertie (1987)(Ubi Soft)(fr)(Disk 1 of 2).dsk\""'

Definitely not great, so maybe the snap owner could change something to quote arguments they receive.

anonyme-x22 commented 1 year ago

Hi,

Simple quote test: env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/caprice32_launcher.desktop /snap/bin/caprice32.launcher '/media/phase_lot/Jeux Consol/Amstrad Cpc/Inertie (1987)(Ubi Soft)(fr)(Disk 1 of 2).dsk' Result: ERROR src/slotshandler.cpp:624 - File not found: 2).dsk

Quote+escaping: env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/caprice32_launcher.desktop /snap/bin/caprice32.launcher "\"/media/phase_lot/Jeux Consol/Amstrad Cpc/Inertie (1987)(Ubi Soft)(fr)(Disk 1 of 2).dsk\"" Result: ERROR src/slotshandler.cpp:624 - File not found: 2).dsk

double+single: env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/caprice32_launcher.desktop /snap/bin/caprice32.launcher '"/media/phase_lot/Jeux Consol/Amstrad Cpc/Inertie (1987)(Ubi Soft)(fr)(Disk 1 of 2).dsk"' Result: ERROR src/slotshandler.cpp:624 - File not found: 2).dsk

Double quote+escaping: env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/caprice32_launcher.desktop /snap/bin/caprice32.launcher '"\"/media/phase_lot/Jeux Consol/Amstrad Cpc/Inertie (1987)(Ubi Soft)(fr)(Disk 1 of 2).dsk\""' Result String ignored

caprice32.launcher does seems to be an executable! i found this file: (command launcher.wrapper)

!/bin/sh

export PATH="$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu/mesa-egl:$SNAP/usr/lib/x86_64-linux-gnu/mesa" export LD_LIBRARY_PATH=$SNAP_LIBRARY_PATH:$LD_LIBRARY_PATH exec "desktop-launch" "$SNAP/bin/caprice32launcher" "$@"

of course just executing cap32 don't works!

Issue forwarded to stan!

Thanks in advance, Have a good day, Rgds,

ColinPitrat commented 1 year ago

Ah, there are quotes around the $@ so single quotes around double quotes won't work, but the reverse may:

env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/caprice32_launcher.desktop /snap/bin/caprice32.launcher "'\"/media/phase_lot/Jeux Consol/Amstrad Cpc/Inertie (1987)(Ubi Soft)(fr)(Disk 1 of 2).dsk\"'"

In any case this isn't very usable (at this point you're better off renaming the file). So the snap should be fixed.

anonyme-x22 commented 1 year ago

Hi,

that don't works also: env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/caprice32_launcher.desktop /snap/bin/caprice32.launcher "'\"/media/phase_lot/Jeux Consol/Amstrad Cpc/Inertie (1987)(Ubi Soft)(fr)(Disk 1 of 2).dsk\"'" Result String ignored

Yes i tought about copying it somewhere without space and rename it before opening but that's also not very usable. Hope stan would do something!

Thanks in advance, Rgds,

stanmichalski commented 1 year ago

Hello, Happy you tried my Caprice32 snap. I did a new release of this snap to try to fix that issue. Path on the snap store is always the same : https://snapcraft.io/caprice32

News:

Exemples how to launch Caprice32 : snap run caprice32.launcher snap run caprice32.launcher "pathGameA.dsk" snap run caprice32.launcher "pathGameA.dsk" "pathGameA.dsk" Notice : use double quote if pathfile contains spaces.

To use joystick into strict confinement mode run command : snap connect caprice32:joystick

To calibrate joystick/pad run command : sudo jstest-gtk

To display your snaps in desktop launcher run command : sudo ln -s /var/lib/snapd/desktop/applications /usr/share/applications/snapd

Regards. Stan