Strange question about cat

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Strange question about cat

Post by T-Bone »

On http://love2d.org/wiki/Game_Distribution, it is written that on Linux, you can create an excecutable from a .love file by writing "cat love game.love > game" (of course changing "game" to the name of your game). This simply does not work (it can't find "love" even if it's installed). I think I understand what it tries to do (create a text file called "game" containing the text "love game.love"), and this can be done graphically with gedit very easily, but if cat can really create text files (never used it that way) then the code on the wiki should be corrected.

Or maybe I have misunderstood something? Perhaps it's referring to some binary version of LÖVE for Linux, which cat merges with your .love file?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Strange question about cat

Post by Robin »

You are very wrong indeed.

cat concatenates files. It needs a copy of LÖVE in the same directory, otherwise it will not work. (You can of course do something like "cat /usr/bin/love ...", though.)

What that particular line is, it copies the executable from love and pastes a .love at the end of it, where "game" is the name of the new executable, which runs the provided game.

It is pretty much exactly the same as the Windows version of that action.

EDIT: example:

Code: Select all

$ cat a
first file
$ cat b
second file
$ cat a b
first file
second file
$ cat a b > c
$ cat c
first file
second file
Help us help you: attach a .love.
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: Strange question about cat

Post by T-Bone »

I see. That makes a lot of sense. Perhaps the wiki should be clarified, or am I just stupid? :neko:

But since this seems to copy LÖVE in binary format, will it work on another computer? I'm guessing you would have to, at the very least, make sure to have the 32-bit version of LÖVE installed.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Strange question about cat

Post by bartbes »

It is, indeed, of limited use, because you need not just compatible architectures, but also libraries etc, that's why it is common to distribute the .love for linux users. Something you can do with most package management systems is the creation of a launcher that runs your .love with love, then add love as a dependency for the package.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Strange question about cat

Post by Robin »

In practice it might work better to make a package (.deb or .rpm) from of the .love and add the right version of LÖVE as a dependency.
Help us help you: attach a .love.
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: Strange question about cat

Post by T-Bone »

A simple install script will probably be sufficient for Ubuntu users (first run sudo apt-get install love, then make a launcher and put it in /usr/share/applications)
User avatar
TechnoCat
Inner party member
Posts: 1612
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: Strange question about cat

Post by TechnoCat »

Robin wrote:(You can of course do something like "cat /usr/bin/love ...", though.)

Code: Select all

$ cat `which love` game.love > game.bin
That should do it. And those are graves, not apostrophes.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Strange question about cat

Post by Robin »

Even better.
Help us help you: attach a .love.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 4 guests