Page 1 of 1

I made a .love file creator...

Posted: Thu Jul 14, 2022 10:51 pm
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.

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

Posted: Fri Jul 15, 2022 9:48 am
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"

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

Posted: Fri Jul 15, 2022 10:33 am
by ReFreezed
You can also get rid of the renaming step by specifying .love instead of .zip on the first line.

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

Posted: Fri Jul 15, 2022 11:07 am
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"

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

Posted: Fri Jul 15, 2022 4:16 pm
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.

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

Posted: Wed Jul 20, 2022 10:42 pm
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

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

Posted: Thu Jul 21, 2022 5:37 am
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.

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

Posted: Wed Aug 10, 2022 1:16 am
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!

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

Posted: Wed Aug 10, 2022 5:15 pm
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)