If mods.txt was manually created on windows or edited with a windows text editor, it may contain the windows newline \r\n instead of just the Unix newline \n. This will cause the generation of modlist.txt to fail as there will be an extra \r at the end of the folder name.
That means the mod directory check will always return false:
If mods.txt was manually created on windows or edited with a windows text editor, it may contain the windows newline \r\n instead of just the Unix newline \n. This will cause the generation of modlist.txt to fail as there will be an extra \r at the end of the folder name. That means the mod directory check will always return false:
And changing to the mod directory always return that the directory is nonexistent:
This fix strips the carriage return (\r) from the $modid string so that the string only contains the mod's ID.