Skip to content

Mods that are compressed with paths that use backslash \ rather than forwardslash / get a mod not found error #680

Description

@Acen

Using powershell & Compress-Archive to zip a mod for deployment/testing - I found that YAFC-CE was not able to see it despite it loading fine in-game.
Turns out, that code looking for the info.json file within zip files uses forward slashes to find the info.json is 1 level deep.
e.g. Modname_1.0.0.zip holds > Modname/info.json

Below is my edited version to debug what was happening:

var infoEntry = zipArchive.Entries.FirstOrDefault(x => {
                    Debug.WriteLine($"FullName: {x.FullName}");
                    return x.Name.Equals("info.json", StringComparison.OrdinalIgnoreCase) &&
                    x.FullName.IndexOf('/') == x.FullName.Length - "info.json".Length - 1;});

Compress-Archive, at least in my case with default settings, zipped all the files/folder names to be \ labelled.

This may just be a symptom though, so want to do some sanity checks before putting up a PR to fix.

Edit: Actual link to code @ lastest commit: https://github.com/Yafc-CE/yafc-ce/tree/fd05b1a0b0d452a2deb604ad6473e5dcd751e1f7/Yafc.Parser/FactorioDataSource.cs#L181

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions