(Linux) Making a shell script to launch main.lua will gain you access to the print() function.

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
BrotSagtMist
Party member
Posts: 657
Joined: Fri Aug 06, 2021 10:30 pm

Re: (Linux) Making a shell script to launch main.lua will gain you access to the print() function.

Post by BrotSagtMist »

Uhm... youre looking for a dot.
Like literally "love ." Thats the _script_ to use.
The dot is a shorthand for using the current dir.
As for right click and open, you almost got there, its "love $(dirname %f)", just make a .desktop file for it.
obey
magus_vageta_fusion
Prole
Posts: 6
Joined: Fri Mar 03, 2023 12:13 am

Re: (Linux) Making a shell script to launch main.lua will gain you access to the print() function.

Post by magus_vageta_fusion »

A bash script file with just "love ." results in the following error: "575: No code to run"

A custom launch command with only "love $(dirname %f)" results in the following error: "577: Cannot load game at path '/home/USERNAME/$(dirname'"
(Note that my system username was changed to USERNAME in the example above.)

The same exact error happens when it is a .desktop file with "love $(dirname %f)" as the command to be used.
User avatar
BrotSagtMist
Party member
Posts: 657
Joined: Fri Aug 06, 2021 10:30 pm

Re: (Linux) Making a shell script to launch main.lua will gain you access to the print() function.

Post by BrotSagtMist »

This should work:

Code: Select all

[Desktop Entry]
Exec=love  $(dirname %f)
Type=Application
Terminal=true
Name=openwithlove
X-KeepTerminal=true
As for the bash script, again, i do NOT understand what you want to do.
"love ." saved in a file and placed inside the project will start the project when clicked, thats what i understand as your intention.
obey
magus_vageta_fusion
Prole
Posts: 6
Joined: Fri Mar 03, 2023 12:13 am

Re: (Linux) Making a shell script to launch main.lua will gain you access to the print() function.

Post by magus_vageta_fusion »

Before, I was making the .desktop file through the menus of the OS, and on the desktop.

Counter to that, I then put your code in a text editor and saved it as a .desktop file. The file opens, but not without error 577. It seems that "$(dirname %f)" is never parsed.

It does indeed seem like "love ." should work for a bash script file, but it simply doesn't, and all it says is that there's no code to run, error 575. perhaps the dot is also never parsed. I do think you have the right idea of my intention, but your code doesn't work, even if I add a sleep command.

The custom launch command i brought up before is not a .desktop file, or a bash script file. It is simply a field in a menu of Linux Mint. You see it when choosing an application to open your file with.
Last edited by magus_vageta_fusion on Fri Mar 03, 2023 6:27 pm, edited 1 time in total.
User avatar
BrotSagtMist
Party member
Posts: 657
Joined: Fri Aug 06, 2021 10:30 pm

Re: (Linux) Making a shell script to launch main.lua will gain you access to the print() function.

Post by BrotSagtMist »

Having that tried and it works here, hard to grasp why it doesnt for you.
Is mint doing stuff different than other distros? Ask in their channel i would suggest.
obey
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests