Page 1 of 2

Remove Version requirment from mod folder names

Posted: Sat Dec 17, 2016 2:27 am
by Nexela
2 Slightly related requested changes regarding unzipped mods:

#1 Unzipped mods should not be required to have the version # appended to it.

If someone makes changes to a mod that include a change in version in info.json # (i.e new migrations/on_config_changed etc), they now have to rename all of their folders with the new version # before they can test their changes. This gets doubly annoying if the mod being tested has some sort of Version Control system and you are constantly going back and for between 2 (or more) versions for testing/fixes

#2 Unzipped mods should be ignored when updating in game (or have some way of manually clicking to add them to the update list). Chances are a config change or other local change was made and upgrading without thinking can throw this out the windows.

Just my 2 cents.

Re: Remove Version requirment from mod folder names

Posted: Sat Dec 17, 2016 4:54 am
by Ranakastrasz
Same here. If there was an easy way to use git or similar with a folder that keeps changing name, this is fine. But there isnt, so its a problem.

This is my second least favorite part of nodding. Worst part is getting migration scripts to work.

Re: Remove Version requirment from mod folder names

Posted: Sat Dec 17, 2016 5:53 am
by Nexela
Ranakastrasz wrote:Same here. If there was an easy way to use git or similar with a folder that keeps changing name, this is fine. But there isnt, so its a problem.

This is my second least favorite part of nodding. Worst part is getting migration scripts to work.
Migrations are easy. .json for swapping one item to another, .lua to change anything in game. (but no global)

Re: Remove Version requirment from mod folder names

Posted: Sat Dec 17, 2016 7:58 am
by Mooncat
I like #1. The most troublesome part for the current approach IMO is the need to set up the whole workspace again after changing the mod folder name, thus the references to files are lost.

I'm not sure about #2. Unzipped mods are supposed to be used for quick testing. If the changes are not recognized by the game, it will lose their purpose.
But I guess manual update will do the job, according to FFF #168.

Ranakastrasz wrote:Same here. If there was an easy way to use git or similar with a folder that keeps changing name, this is fine. But there isnt, so its a problem.
You can create a folder above the mod folder and use it as a repo, so changing the mod folder name will not affect the reference to that repo. ;)

Re: Remove Version requirment from mod folder names

Posted: Sat Dec 17, 2016 8:16 am
by Nexela
Mooncat wrote:I like #1. The most troublesome part for the current approach IMO is the need to set up the whole workspace again after changing the mod folder name, thus the references to files are lost.

I'm not sure about #2. Unzipped mods are supposed to be used for quick testing. If the changes are not recognized by the game, it will lose their purpose.
But I guess manual update will do the job, according to FFF #168.

Ranakastrasz wrote:Same here. If there was an easy way to use git or similar with a folder that keeps changing name, this is fine. But there isnt, so its a problem.
You can create a folder above the mod folder and use it as a repo, so changing the mod folder name will not affect the reference to that repo. ;)
Symlinks/junctions are your friend here as the only thing you need to change is the shortcut name in the mods folder. Which is still a pain and hence the change

Factorio/Devel/name_of_repository -- your mod code here

Factorio/Mods/name_of_repositry_0.0.0 -- junction to name_of_repository

As for #2 if a mod is unzipped it is typically for a reason i.e. config change or some other changes in a mod pack

Re: Remove Version requirment from mod folder names

Posted: Sun Dec 18, 2016 9:23 pm
by Ranakastrasz
While I can make it inside another folder, and make that an archive instead, if I do that the comparison function fails since literally everything changes when I change the version.

Where Can I learn about "Symlinks/junctions?"

Re: Remove Version requirment from mod folder names

Posted: Sun Dec 18, 2016 11:23 pm
by Rseding91
Nexela wrote:#1 Unzipped mods should not be required to have the version # appended to it.
That would defeat the entire purpose of the requirement if it wasn't there for unzipped.
Nexela wrote:#2 Unzipped mods should be ignored when updating in game (or have some way of manually clicking to add them to the update list). Chances are a config change or other local change was made and upgrading without thinking can throw this out the windows.
The game makes no differentiation between zipped or unzipped mods as that would make no sense. If someone does manual modification of a mod then it's up to them to handle those changes.

Re: Remove Version requirment from mod folder names

Posted: Mon Dec 19, 2016 12:13 am
by Yoyobuae
So I decided to cook up a quick solution for myself:
http://sprunge.us/cWYC

Code: Select all

#!/bin/sh

DEPLOY_DIR=__user_folder__/mods/
MOD_NAME=${1%/}
MOD_VERSION=$( cd ${MOD_NAME} ; python << 'EOFEOF'
import json
with open("info.json") as file:
	print(json.load(file)[u'version'])
EOFEOF
)
git --git-dir=${MOD_NAME}/.git archive --format zip --output ${DEPLOY_DIR}/${MOD_NAME}_${MOD_VERSION}.zip master
It's a small shell script which finds out the mod version from the JSON file and creates a zip file at the right location with the right name. Now I can just keep my mods in a separate dir without the version in the dir name.

Just replace __user_folder__ accordingly.

Re: Remove Version requirment from mod folder names

Posted: Mon Dec 19, 2016 11:50 am
by bobingabout
Nexela wrote:If someone makes changes to a mod that include a change in version in info.json # (i.e new migrations/on_config_changed etc), they now have to rename all of their folders with the new version # before they can test their changes. This gets doubly annoying if the mod being tested has some sort of Version Control system and you are constantly going back and for between 2 (or more) versions for testing/fixes
I can agree this is annoying. it caused no end of problems for my 3rd party locale mod, in that one version was updated, where the other wasn't, and vica verca. long story short, they didn't match, which caused an issue.

As a modder myself though, it is a pain in the arse making sure they both match all the time. I never used to have a number on my folders, just the zip file when I made one, and that worked fine for me until the version requirement came in, then it was a huge headache.

Re: Remove Version requirment from mod folder names

Posted: Mon Dec 19, 2016 1:56 pm
by Nexela
I just don't understand the version requirement at all. It reads the info.json to tell you that it doesn't match so......

Re: Remove Version requirment from mod folder names

Posted: Mon Dec 19, 2016 2:04 pm
by orzelek
Nexela wrote:I just don't understand the version requirement at all. It reads the info.json to tell you that it doesn't match so......
This is the part I don't really understand.
It needs to look into zip anyway to grab the json and read the version number. So why it also needs folder name to have the version?

When mod is extracted folder name needs to match mod name afaik but why need the version in there if you have it in json.

Re: Remove Version requirment from mod folder names

Posted: Mon Dec 19, 2016 3:10 pm
by bobingabout
There was a reason for it given when they decided to add it in the first place. I think it was somewhere mid 0.11 or something, I forget. But there should still be a topic floating around somewhere that details why they added it.

But yeah, the obvious answer is: so you can tell at a glance what version you have installed... and although this might be useful for a zip file you've downloaded... the necessity is lost, I mean, it's right there in the json file. There's no logical reason I can think of WHY you NEED it, especially considering it loads the json files to get the version numbers anyway, and instead of loading the mod, throws and error telling you it has no version number in the zip/folder name. Just load the damn mod!

Allow uncompressed mod folders without version

Posted: Sat Apr 13, 2019 12:22 pm
by danielbrauer
Like many modders, I'm using git to version my work. This works nicely except when I have to bump the version number. The process is:
  • Close the VSCode workspace
  • Close the repo in SourceTree
  • Rename the folder
  • Open the workspace again
  • Change the info file to match
  • Open the repo again
  • Commit
If Factorio allowed mod folders without a version number (as a special case: it should still check that they match if they're there), the process would look like this:
  • Change the info file
  • Commit
Ooh, that would be so satisfying...

Re: Remove Version requirment from mod folder names

Posted: Sat Apr 13, 2019 12:32 pm
by Bilka
Merged the above post into this older topic.

Re: Remove Version requirment from mod folder names

Posted: Sat Apr 13, 2019 4:40 pm
by danielbrauer
I feel like I’ve missed the original premise: what’s the reason for the version number requirement for folders?

Re: Remove Version requirment from mod folder names

Posted: Sun Apr 14, 2019 9:08 am
by darkfrei
danielbrauer wrote:
Sat Apr 13, 2019 4:40 pm
I feel like I’ve missed the original premise: what’s the reason for the version number requirement for folders?
Only this way you can have more than one version simultaneously.
But why we need more than on unzipped mod folder - real question.

Re: Remove Version requirment from mod folder names

Posted: Sun Apr 14, 2019 9:14 am
by danielbrauer
You could still have more than one version if one was allowed without a version number. The one without the version number should just take precedence.

Re: Remove Version requirment from mod folder names

Posted: Sun Apr 14, 2019 3:47 pm
by Rseding91
danielbrauer wrote:
Sat Apr 13, 2019 4:40 pm
I feel like I’ve missed the original premise: what’s the reason for the version number requirement for folders?
The primary reason: so everyone can quick and easily see which version of which mod is in the mod(s) folder.

The other benefits:

* It makes for an easy way to have multiple of the same mod installed without having to go change otherwise working mods.
* It gives a consistent naming scheme for mods

But at the end of the discussion it doesn't matter what anyone else says here we are not changing it.

Re: Remove Version requirment from mod folder names

Posted: Mon Apr 15, 2019 12:51 pm
by danielbrauer
Ok so one last possibility: a “development mode” option for Factorio which loosens the naming requirement for mod folders. Obviously I don’t know the complexity of the code involved, but that seems like it shouldn’t be too much work to maintain, considering how many modders would appreciate it. It also feels like most users wouldn’t touch such an option, so you’d still get the benefits of strict naming requirements for 99% of your user base.

Re: Remove Version requirment from mod folder names

Posted: Mon Apr 15, 2019 1:06 pm
by darkfrei
Rseding91 wrote:
Sun Apr 14, 2019 3:47 pm
The primary reason: so everyone can quick and easily see which version of which mod is in the mod(s) folder.

The other benefits:

* It makes for an easy way to have multiple of the same mod installed without having to go change otherwise working mods.
* It gives a consistent naming scheme for mods
Is it about zip archives or about folders? On mod creating I haven't any archive, but only one version of folder. On mod using I haven't any folder, but a lot of archives, I can see the version of them.