Allow mod zip files to have version numbers

Post Reply
sparr
Smart Inserter
Smart Inserter
Posts: 1327
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Allow mod zip files to have version numbers

Post by sparr »

The game seems to expect a mod's zip file to have the same name as the mod's directory would have. This is annoying when mods have different versions available for download. For example, right now in my downloads folder I have "testingmode.zip" and "testingmode (1).zip" and "testingmode (2).zip" because I've downloaded three different versions of the mod all named testingmode.zip. I named the downloads for my own mod something_0.1.zip but this confuses the game because it can't match up __something__/ to that zip file.

If there was some standard schema for version numbering on mod zip files then the game might just ignore that schema at the end of zip/directory names.

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Allow mod zip files to have version numbers

Post by kovarex »

That is a good point.
Do you have some advice about the notation? :)

slay_mithos
Fast Inserter
Fast Inserter
Posts: 204
Joined: Tue Feb 25, 2014 7:22 am
Contact:

Re: Allow mod zip files to have version numbers

Post by slay_mithos »

How about 'MODNAME[0.1.2].zip' ?

Using such characters makes it easy for both a program and the users to identify the verison numbers

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Allow mod zip files to have version numbers

Post by kovarex »

Yes, that is a good one, we use it already on the forums, I put this as an issue into our inernal tracker.
Thank you for the idea :)

SilverWarior
Filter Inserter
Filter Inserter
Posts: 559
Joined: Mon Mar 04, 2013 9:23 am
Contact:

Re: Allow mod zip files to have version numbers

Post by SilverWarior »

Are square brackets alowed characters that can be used in file names on all suported platforms? I'm not sure they are but I may be wrong.

slpwnd
Factorio Staff
Factorio Staff
Posts: 1835
Joined: Sun Feb 03, 2013 2:51 pm
Contact:

Re: Allow mod zip files to have version numbers

Post by slpwnd »

Square brackets are tricky. I think something like name_version will be safer ...

ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: Allow mod zip files to have version numbers

Post by ficolas »

What about if the game ignores the zip name, and only takes the name of a folder that should be inside the zip?
So:
Modfolder can be used in the mods folder.
Modzip that contains modfolder can also be used in the mods folder, and the game ignores the name Modzip haves.

This way, zip files can be used compressed or non compressed, so when the we need to upload our mod, we dont need to compress the files inside Modfolder, we just compress the whole folder, and the whole folder can be used for us, modders to be able to edit easily the mod.

sparr
Smart Inserter
Smart Inserter
Posts: 1327
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: Allow mod zip files to have version numbers

Post by sparr »

good idea, ficolas.

how do you propose handling two zips with the same folder inside them?

ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: Allow mod zip files to have version numbers

Post by ficolas »

sparr wrote:good idea, ficolas.

how do you propose handling two zips with the same folder inside them?
Error?
Two versions of the same mod shouldnt exist in the same place.
Or reading the info.json file to see what version is higher.

User avatar
AlexPhoenix
Fast Inserter
Fast Inserter
Posts: 149
Joined: Tue Feb 18, 2014 7:48 am
Contact:

Re: Allow mod zip files to have version numbers

Post by AlexPhoenix »

just make folder name just folder name, not mod name.
so any info must come from json.

drs9999
Filter Inserter
Filter Inserter
Posts: 831
Joined: Wed Mar 06, 2013 11:16 pm
Contact:

Re: Allow mod zip files to have version numbers

Post by drs9999 »

AlexPhoenix wrote:just make folder name just folder name, not mod name.
so any info must come from json.
+1

Also if the mod folder contains 2 or more versions of the same mod, I would like the following:

If both mod-version are enabled then use the most recent version (and notify the player about it) otherwise use the version that is enabled

Dark
Long Handed Inserter
Long Handed Inserter
Posts: 83
Joined: Wed May 07, 2014 12:45 pm
Contact:

Re: Allow mod zip files to have version numbers

Post by Dark »

Bump. What if Factorio ignored both folder name, zip names, any file system names. But instead used "name" property from the info.json?
Right now mod naming is still crippled, zip-file-name == mod-folder-name or you gonna have a bad time.

User avatar
SHiRKiT
Filter Inserter
Filter Inserter
Posts: 706
Joined: Mon Jul 14, 2014 11:52 pm
Contact:

Re: Allow mod zip files to have version numbers

Post by SHiRKiT »

Makes total sense to use "name" as the identifier, since it should be unique anyways. Just do a split on the version and check

Code: Select all

table loadTheseMods
foreach mod in allModsFound do
  if loadTheseMods contains mod.name then
    currentVersion = loadTheseMods.getValue1(mod.name).version
    split1[] = string.split(currentVersion)
    split2[] = string.split(mod.version)
    higher = true
    for index = 0 up to max(split1.length, split2.length) do
      if split1[index] = nil and split2[index] != nil then
        do nothing
      elseif split1[index] != nil and split2[index] = nil then
        higher = false
      elseif int.parse(split1[index]) > int.parse(split2[index]) then
        higher = false
      endif
    endfor
    if higher then
      loadTheseMods.overwrite(mod.name, mod)
    endif
  elseif
    loadTheseMods.put(mod.name, mod)
  endif
endforeach

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Allow mod zip files to have version numbers

Post by kovarex »

This will be done for 0.10.7

We decided to force one unified system to be used to make it organised.
So the mod zip package (and the folder inside) needs to have format "<Mod name>_<Mod version>" it will be checked if the format matches the version and the mod game at the start of the game.

This will invalidated all existing mods, but since the fix is very simple it shouldn't be so huge problem. We believe that it is better to do these kind of changes while it is in alpha.

Post Reply

Return to “Implemented mod requests”