Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Factorio installation not detected on Linux #3

Closed
remexre opened this issue Jun 25, 2017 · 10 comments
Closed

Factorio installation not detected on Linux #3

remexre opened this issue Jun 25, 2017 · 10 comments

Comments

@remexre
Copy link

remexre commented Jun 25, 2017

I think the issue is case-sensitivity -- https://github.com/Arnavion/fac-rs/blob/master/factorio-mods-local/src/api.rs#L185 uses SteamApps, where as (my installation of) Steam uses steamapps

@Arnavion
Copy link
Owner

Yeah, I don't have a Factorio install on Linux so I've only tested the web API there.

Can you check which one of the paths (if any) in https://github.com/mickael9/fac/blob/401fe28d/fac/files.py#L13-L40 matches your install?

@remexre
Copy link
Author

remexre commented Jun 25, 2017

None -- the case on SteamApps is wrong there too. I think it might be named SteamApps on Windows and steamapps on Linux, although I don't have a windows install near me to check.

It also looks like fac-rs doesn't search ~/.factorio, which contains the mods/mod-list.json and player-data.json files.

@Arnavion
Copy link
Owner

Right, so what's the full path of your Factorio install then?

@remexre
Copy link
Author

remexre commented Jun 25, 2017

/home/nathan/.local/share/Steam/steamapps/common/Factorio is the static files, /home/nathan/.factorio is the per-user data

@remexre
Copy link
Author

remexre commented Jun 25, 2017

I patched it to add ~/factorio and ~/.factorio to the search path and fix the capitalization, but now it dies because mod_list.json uses the string "true" instead of the boolean true for "enabled".

@Arnavion
Copy link
Owner

The true vs "true" is a change in 0.15 I believe. I changed it in ad35af38

@remexre
Copy link
Author

remexre commented Jun 25, 2017

I just deleted ~/.factorio, disabled Steam Cloud Sync, and started the game, and ~/.factorio/mods/mod-list.json was created with the contents:

{
    "mods": [
        {
            "name": "base",
            "enabled": "true"
        }
    ]
}

One solution would be to use #[serde(deserialize_with = "path")] to make a custom deserializer that accepts either a bool or a string, I guess.

@Arnavion Arnavion reopened this Jun 25, 2017
@remexre
Copy link
Author

remexre commented Jun 25, 2017

It looks like cfg!(linux) isn't actually a thing -- cfg!(target_os = "linux") works, though.

@Arnavion Arnavion reopened this Jun 25, 2017
@Arnavion
Copy link
Owner

deserialize_with may not be enough, since when it writes the file back it'll write the values as booleans even if they were originally strings. Just to confirm, you're on 0.14 right? Can you check if the game is able to load mod-list.json with boolean values instead of string values?

@remexre
Copy link
Author

remexre commented Jun 25, 2017

I'm on version 0.14.23, build 25374, and it's working as far as I can tell with plain bool. EDIT: The game does change it back to "true" on exit, though.

Arnavion pushed a commit that referenced this issue Jun 25, 2017
…-list.json`

0.15 writes booleans. 0.14 writes strings but is reported to read booleans just fine. So support deserializing both, and continue serializing as booleans.

Ref #3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants