Artorp / Profilio

A profile manager for Factorio
GNU Lesser General Public License v3.0
5 stars 0 forks source link

Profilio wont start on after closing Factorio #4

Closed hraesvelgr closed 5 years ago

hraesvelgr commented 6 years ago

Hello,

after trying out Profilio for the first time (runs smooth, no problems) and setting up a profile, i started factorio to check if profilio works properly. then i closed factorio, profilio seemed to be also closed and i tried to restart profilio by clicking on the downloaded executable: nothing happened.

it does not start a process, it does not give an error message, there does not happen anything at all. restart and re-download gave the same issue: i was not able to start profilio or start the process at all.

Win 7 Professional, Servicepack 1

Artorp commented 6 years ago

Hi,

Does the .jar file work? Try to download and run the .jar file instead of the executable (Java must be installed, Java 8 (1.8.x) or newer is required).

If that fails I'll need more information to debug this error. Could you post your log file? It should be located under %APPDATA%\factorio_profilio titled profilio-current.txt (e.g. C:\Users\Username\AppData\Roaming\factorio_profilio\profilio-current.txt).

Similarly, what's the contents of the settings.json file?

You can use something like http://pastebin.com/ to share the contents.

What happens when you run the file from the command line? Open CMD, navigate to the jar file (with the cd command, e.g. cd C:\Users\Username\Downloads, then start the jar package with java -jar profilio-1.0.2.jar.

Have you tried running the file as administrator? Shouldn't be required, but maybe I missed something and an uncaught exception is thrown.

You mentioned the program working as expected on the first run. If you manually undo the changes Profilio made it should start again. Will it always fail to start after creating a new profile?

Short version of how to undo the changes: Profilio makes junction links from your profile folder to the factorio data folder. Delete the junction links within the data folder, and copy/move the source folders from the profile folder back to the factorio data folder. Finally, delete the Profilio configuration (factorio_profilio).

A more detailed step by step of how to undo the changes made by Profilio:

  1. Navigate to the factorio_profilio folder and open settings.json in a text editor. Note the "factorioDataPath" and the "factorioProfilesPath" paths.
  2. Make backups of both folders to be safe.
  3. Go to the factorioDataPath folder, it should be where your factorio saves should be located, usually %APPDATA%\Factorio.
  4. If the "mods" and "saves" folders look like shortcuts, it should be safe to delete them.
  5. Navigate to the factorioProfilesPath folder. It should contain folders for each profile, each with a "saves" and "mods" folder within. Copy the "saves" and "mods" folders to your factorioDataPath.
  6. Verify that your factorio data folder (%APPDATA%\Factorio) has both a saves and mods folder, and that you can access the saves from within the Factorio game.
  7. Delete the factorio_profilio folder and optionally the profile folder.
  8. Verify again that factorio can load the save.
  9. It is now safe to delete the backups.

PS: Starting Factorio from Profilio will close Profilio by default, but this can be changed in the settings.

hraesvelgr commented 6 years ago

java 8 (Build 1.8.0_171-b11)

running jar-file causes the same issue

logfile: https://pastebin.com/LxmiLth8

a fellow java developer told me, that it cannot find the path to the executable. putting the executable in a different folder like the profilio folder does not solve the problem.

running from command line (as admin): cannot find path.

deleting the appdate\factorio folder did it. the program starts.

but: when trying to do a first time save transfer, it gives the following error: https://pastebin.com/Lzpk0Gbk

i dont know if this helps, but i have an accent in a letter of the directory path: André, so the "é". may this be the root of the problem? this is an error after manually changing the "é" to an "e": https://pastebin.com/xhTZ2gu8

thats all i can give. i dont know how exactly i managed to run it first time.

thank you for your fast answer :)

Artorp commented 6 years ago

Thanks for the crash logs and detailed writeup :)

By looking at the logs I'm convinced the letter é is the root to the problem. But it's not immediately obvious to me where exactly things go wrong. Main suspects are the the java.io library somewhere, incorrect Gson encoding configuration, or System.getenv not handling non-ascii chars properly. Reproducing this error should be quite straightforward though.

By looking inside the settings.json file with a text editor, does the configPath value include the accent for the folder name? E.g. does it say C:\\Users\\André\\AppData... instead of C:\\Users\\Andr?\\AppData...?

I'm a bit busy this week but I'll look into this bug next week or maybe this weekend. I'm sure I can reproduce this bug quite easily, and then it's just a matter of figuring out where things went wrong.

hraesvelgr commented 6 years ago

the settings.json writes the letter é as a ?, so:

C:\\Users\\Andr?\\AppData...

weirdly enough, it sometimes writes é and sometimes ?

{ "configPath": "C:\\Users\\Andr?\\AppData\\Roaming\\factorio_profilio", "factorioDataPath": "C:\\Users\\André\\AppData\\Roaming\\Factorio", "factorioProfilesPath": "C:\\Users\\André\\AppData\\Roaming\\Factorio\\fpm", "moveMethod": 1, "closeOnLaunch": false, "hasInitialized": true, "activeProfilePath": "C:\\Users\\André\\AppData\\Roaming\\Factorio\\fpm\\default_profile", "factorioInstallations": [ { "customName": "Factorio executable", "path": "G:\\Steam\\SteamApps\\common\\Factorio\\bin\\x64\\factorio.exe", "useCustomConfigPath": false, "customConfigPath": null } ], "profileToFactorioName": [ { "profileName": "default_profile", "factorioName": "Factorio executable" } ] }

Artorp commented 6 years ago

I managed to reproduce this bug and made a patch that fixed it on my local machine. Before I deploy the new release, would you mind testing it to see if it works?

Attached to this post is a zipped jar file, you'll need to unpack it before running it.

profilio-1.0.3-SNAPSHOT.jar.zip

Before running it, ensure the following is true for a clean start:

  1. The profile folder is empty / does not exist
  2. The factorio_profilio folder is empty or deleted (it would be best for Profilio to generate an entirely new settings.json file)
  3. You have successfully ran Factorio and saved a new game
    • In other words, the folder %AppData%\Factorio exists and it contains the folders saves and mods.

If it does not work, please post the log and I'll see what I can do.

hraesvelgr commented 6 years ago

followed your steps, deleted everything profilio related from my machine.

working as intended now.

it does not give any error, saving a game is possible, creating and running different profiles is possible. thank you!

a recommendation i'd make: add a message (popup window or such) that, when running a profile, it should say "copying save-files now" or something until the game runs. when running a new profile with an empty save-folder (given that the user has many, many saves-files) the program takes a while to copy all the saves into the fpm-related save-folder and nothing happens while profilio works. i tought it doesnt work again (until factorio opened about 40 seconds later) for clarification that everything works smoothly and profilio is doing its work, it would be nice to know what happens in this moment.

Artorp commented 6 years ago

Glad to hear!

By "running a profile", do you mean when you press the "Start Factorio" button? That shouldn't take long at all. All the work into switching profiles happens when an active profile is assigned, all the "Start Factorio" button does is launch Factorio (and optionally close Profilio). It should happen immediately.

Even switching profile should happen immediately, as Profilio will only create links (shortcuts) between the folders (unless the "move" option is chosen).

Does Factorio take a long time to start if you start it from Steam? What if you start it from Windows Explorer (the binary is usually found in C:\Program Files (x86)\Steam\steamapps\common\Factorio\bin\x64)? Do you have antivirus software running?

FYI it's possible to change profile and then launch Factorio independently, such as from Steam.

Artorp commented 5 years ago

Closing as issue was resolved in v1.0.3