I made a .love file creator...

Show off your games, demos and other (playable) creations.
Post Reply
User avatar
PixelHero
Prole
Posts: 45
Joined: Sat Apr 16, 2022 3:16 am

I made a .love file creator...

Post by PixelHero »

I made a batch program that can turn lua files into love files. The program is one batch file, here's the code:

Code: Select all

@echo off

echo zipping...
"C:\<path_to_7-zip>\7z.exe" a -tzip "%~d1\%~p1\%~n1.zip" 
echo Done!

pause

echo loving...
ren *.zip *.love 
echo Done!

pause
As you can see, you must insert the path to 7-zip, which must be installed in order for this to work. Also, this will only work on recent versions of Windows.

Instructions:
Copy your lua files from the folder, right-click on this program, which you should name Lover.bat, and click paste. That will activate this program, and a black window will pop up. Words will appear, eventually prompting you to press any key. if you press a key, more words will appear, once more prompting you to press a key. After that, the window will disappear, and once that happens, look at the folder that holds your lua files. You will like what you see.
Dragons are great.
User avatar
marclurr
Party member
Posts: 101
Joined: Fri Apr 22, 2022 9:25 am

Re: I made a .love file creator...

Post by marclurr »

Nice. You can remove the 7zip dependency by using Powershell, which has been available on Windows for a few versions now:

Code: Select all

powershell "Compress-Archive -Update -Path <Game-Root-Directory-Path>\* -DestinationPath mygame.zip"
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

Re: I made a .love file creator...

Post by ReFreezed »

You can also get rid of the renaming step by specifying .love instead of .zip on the first line.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
User avatar
marclurr
Party member
Posts: 101
Joined: Fri Apr 22, 2022 9:25 am

Re: I made a .love file creator...

Post by marclurr »

ReFreezed wrote: Fri Jul 15, 2022 10:33 am You can also get rid of the renaming step by specifying .love instead of .zip on the first line.
Annoyingly you can't (at least not with Compress-Archive), but you can still do it in a one-liner:

Code: Select all

powershell "Compress-Archive -Update -Path <Path-To-Game-Root>\* -DestinationPath test.zip; Move-Item -Force test.zip test.love"
User avatar
PixelHero
Prole
Posts: 45
Joined: Sat Apr 16, 2022 3:16 am

Re: I made a .love file creator...

Post by PixelHero »

marclurr wrote: Fri Jul 15, 2022 11:07 am
Annoyingly you can't (at least not with Compress-Archive), but you can still do it in a one-liner:

Code: Select all

powershell "Compress-Archive -Update -Path <Path-To-Game-Root>\* -DestinationPath test.zip; Move-Item -Force test.zip test.love"
I don't really want to use a CLI language I am not familiar with. Besides, I kinda want them to get 7zip if they don't have it already, because it's useful for so many things. Also, just from the looks of that script, it seems like you would have to rewrite it for each new game. For my batch script, all you have to do is copy the files and paste them on top of the batch. However, I don't understand powershell, so I may be wrong, so please correct me.
--Okay, I have now written your code. How do you run powershell?
--Nevermind, I just placed all of your code into a batch file, instead of a powershell file, and it ran. I still like my code better, for it's easiness. I'll try to make one for Linux.
Dragons are great.
User avatar
PixelHero
Prole
Posts: 45
Joined: Sat Apr 16, 2022 3:16 am

Re: I made a .love file creator...

Post by PixelHero »

I think I made one for Linux. Here it is:

Code: Select all

echo Enter the path to the directory of the target file
read PATH
echo Enter the name for the love file
read NAME
echo zipping
zip $NAME.zip $PATH/*.lua
Dragons are great.
User avatar
togFox
Party member
Posts: 770
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: I made a .love file creator...

Post by togFox »

I kinda want them to get 7zip if they don't have it already, because it's useful for so many things.
Not sure you deliberately building in dependencies when there are alternatives because you think they are good for someone is a great marketing choice but you do you.
Current project:
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
User avatar
PixelHero
Prole
Posts: 45
Joined: Sat Apr 16, 2022 3:16 am

Re: I made a .love file creator...

Post by PixelHero »

togFox wrote: Thu Jul 21, 2022 5:37 am Not sure you deliberately building in dependencies when there are alternatives because you think they are good for someone is a great marketing choice but you do you.
Thanks for the insight. Unfortunately, I don't know how to zip in batch without 7zip. If you know, please tell me. Thanks!
Dragons are great.
User avatar
GVovkiv
Party member
Posts: 668
Joined: Fri Jan 15, 2021 7:29 am

Re: I made a .love file creator...

Post by GVovkiv »

PixelHero wrote: Wed Aug 10, 2022 1:16 am
togFox wrote: Thu Jul 21, 2022 5:37 am Not sure you deliberately building in dependencies when there are alternatives because you think they are good for someone is a great marketing choice but you do you.
Thanks for the insight. Unfortunately, I don't know how to zip in batch without 7zip. If you know, please tell me. Thanks!
aren't windows (and most if not all linux distros) have out-of-box "zip" utility or some sort of it?
Like:

Code: Select all

zip -r archive_name.zip folder_to_compress
?
Based on this https://superuser.com/questions/201371/ ... ne-windows, it seems, windows 10 (and probably 11 and 8) have "Compress-Archive", which you can use on windows without 3rd party soft:

Code: Select all

powershell Compress-Archive . publish.zip
(answers in link mentions other ways to zip files with built-in functionality, so check them also)
Post Reply

Who is online

Users browsing this forum: No registered users and 49 guests