[Solved] Can't change the data directory.

Anything that prevents you from playing the game properly. Do you have issues playing for the game, downloading it or successfully running it on your computer? Let us know here.
AndyMissed
Burner Inserter
Burner Inserter
Posts: 12
Joined: Thu Feb 08, 2018 7:16 am
Contact:

[Solved] Can't change the data directory.

Post by AndyMissed »

So I want to move:

Code: Select all

C:\Users\(Name)\AppData\Roaming\Factorio
to:

Code: Select all

D:\Games\Factorio
because I don't like the idea of having those files on my boot drive.

How I did it:

I modified config-path.cfg. I changed "config-path=(default path)" to "config-path=D:/Games/Factorio/config" and also changed "use-system-read-write-data-directories" to "false" (Changing this to true or false seems to change nothing). I proceeded to cut the Factorio folder from %AppData% into "D:\Games". I then changed both "write-data=" and "read-data=" to have "D:\Games\Factorio" as their directory. I was fairly certain this should work.

What happened:

I clicked "Play" through Steam and it said "Preparing to launch Factorio...", and come to find out, Steam was pulling my saves from the cloud and putting them in %Appdata%\Factorio\saves (the folders were generated). And after it did that, this happened:
Image

So obviously I'm dumb, and now I can't launch the game. I've tried looking on this forum and other places but can't seem to find what I'm looking for, so I hope this post is not unwarranted. Any help is appreciated. Thank you.

Edit:
[Solved] How to change the entire default user data directory (Steam version)(Windows):

This is a guide to change the default directory of where all the data from Factorio goes. It's mostly fail proof and should be easy to do for moderate PC users, but if you're unsure about any of these steps, then proceed with caution.

Step 1:
With some patience, you'll need to start by modifying "config-path.cfg", which will just look like "config-path" with extensions hidden.
(This file should be in C:\Program Files(x86)\Steam\steamapps\common\Factorio\config by default on windows. This is mainly a walkthrough for windows users, so if you're using OSX or Linux I'm sorry)
You'll want to modify "config-path=" (I highly suggest you use Notepad++) to something like this:

Code: Select all

config-path=<Drive letter>:\<Any combo of folders>\Factorio\config
config-path=D:\Games\Factorio\config
The 2 lines are just examples, the top is the format and the bottom is the end result. You can use whatever directory you want to an extent. However, I am told that things may break if the game updates because Steam will overwrite the cfg file. In order to make sure this doesn't happen (Credit goes to posila for telling me this solution), simply right-click Factorio for "Properties" and then "Launch options" through Steam and type something like this:

Code: Select all

--config=<Drive letter>:\<Your combo of folders>\Factorio\config\config.ini
--config=D:\Games\Factorio\config\config.ini
This tells Steam where an important config file for factorio is located that is called "config.ini". So replace the directory accordingly. (config.ini is required at the end, so don't leave it out)

Step 2:
Backup your Factorio directory before you move it to where you want it.
(Default location of the data directory is C:\Users\<Username>\AppData\Roaming\Factorio. AppData is a hidden folder on windows, so you may have to enable "Show hidden files, folders, and drives" in File Explorer Options)
After that's done, move\cut that Factorio folder into your folder of choice. Example: D:\Games (If moving from one explorer window to another, make sure to hold the shift key to move instead of copy if between 2 drives)

Step 3:
Open up the config.ini file with Notepad++ and change "write-data=" to:

Code: Select all

write-data=<Drive letter>:\<Wherever you end up putting the Factorio folder>\Factorio
write-data=D:\Games\Factorio
And you should be good to go. Pro tip for Steam users: don't change "read-data=", it's already set to where the game is. I learned this the hard way. Otherwise you'll get an "Error configuring paths: there is no package core in (path)".

Step 4(?):
If you follow the steps correctly, everything should work, but Steam is a derpy creature. If you click "Play" and you get the "Preparing to launch Factorio..." for a while, let it load. Steam is taking your saves from the cloud and PUTTING THEM BACK in C:\Users\<Username>\AppData\Roaming\Factorio\saves. So if you are having this problem, you'll have to create a system link, as I don't know how to officially "fix" this issue. This only appears to happen with Steam. Below are some steps to make the system link.

1. Delete the "saves" folder Steam just created.
2. Open command prompt in administrator. Right click the Windows icon in the task bar at the bottom left and there should be an option called "Command Prompt (Admin)".
3. In command prompt type:

Code: Select all

cd C:\Users\<Username>\AppData\Roaming\Factorio
4. Next, create the system link with the following examples:

Code: Select all

mklink(This is the command to make the link) /<Drive Letter> <System Link Name> <Directory Symlink Points To>
mklink /D saves D:\Games\Factorio\saves
5. If you did this correctly, you're done. Close command prompt and launch Factorio.

Tips:
-Make sure NOT to type "cd C:\Users\<Username>\Appdata\Roaming\Factorio\saves" in cmd prompt before using the mklink command or you will create a symlink called "saves" that is inside "saves" and the symlink will not work.
-Inside config-path.cfg, there is an option called "use-system-read-write-data-directories", and for the Steam version, this appears to do nothing. But if you encounter problems in the future, try changing it to "false".

Phew, that's all I've got for now. Hopefully if you're reading this and you were encountering the same issues, this helped. If it did, let me know. Thanks.

Sources:
https://wiki.factorio.com/Application_directory
https://wiki.factorio.com/Application_d ... _directory
Last edited by AndyMissed on Thu Feb 08, 2018 7:38 pm, edited 4 times in total.

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2632
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: I can't change the data directory. What am I doing wrong?

Post by steinio »

Using \ instead of / in the path could help.
Image

Transport Belt Repair Man

View unread Posts

AndyMissed
Burner Inserter
Burner Inserter
Posts: 12
Joined: Thu Feb 08, 2018 7:16 am
Contact:

Re: I can't change the data directory. What am I doing wrong?

Post by AndyMissed »

steinio wrote:Using \ instead of / in the path could help.
Alright, I tested using backslashes in both the ini and cfg and it didn't change anything :L

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: I can't change the data directory. What am I doing wrong?

Post by eradicator »

As far as i can tell factorio doesn't care about back/slash differences. You can use relative paths btw, which is what i do. Though i use the zip version and have no clue what steam expects. As a workaround i guess you could use the zip version and add a steam shortcut manually...

Here's what my files look:

Code: Select all

#X:/factorio/data/latest/config-path.cfg
config-path=__PATH__executable__/../../config
use-system-read-write-data-directories=false

#X:/factorio/config/latest/config.ini
read-data=__PATH__executable__\..\..\data
write-data=__PATH__executable__/../../../../config/latest
My factorio exe is at X:\factorio\data\latest\bin\x64\factorio.exe just for reference.

Edit:
Hm. Looking at the config-path value that doesn't make a lot of sense. It's probably completely ignored (like it says in the file) as i use cli parameters to speficy the path of config.ini.

AndyMissed
Burner Inserter
Burner Inserter
Posts: 12
Joined: Thu Feb 08, 2018 7:16 am
Contact:

Re: I can't change the data directory. What am I doing wrong?

Post by AndyMissed »

eradicator wrote:As far as i can tell factorio doesn't care about back/slash differences. You can use relative paths btw, which is what i do. Though i use the zip version and have no clue what steam expects. As a workaround i guess you could use the zip version and add a steam shortcut manually...

Here's what my files look:

Code: Select all

#X:/factorio/data/latest/config-path.cfg
config-path=__PATH__executable__/../../config
use-system-read-write-data-directories=false

#X:/factorio/config/latest/config.ini
read-data=__PATH__executable__\..\..\data
write-data=__PATH__executable__/../../../../config/latest
My factorio exe is at X:\factorio\data\latest\bin\x64\factorio.exe just for reference.

Edit:
Hm. Looking at the config-path value that doesn't make a lot of sense. It's probably completely ignored (like it says in the file) as i use cli parameters to speficy the path of config.ini.
Yeah, maybe it doesn't like my direct approach. Should I be using "__PATH__executable__" and those double-dot things to specify instead? Even though I'm not really sure what either of those do exactly...

Edit: -Removed extra "Those"

AndyMissed
Burner Inserter
Burner Inserter
Posts: 12
Joined: Thu Feb 08, 2018 7:16 am
Contact:

Re: I can't change the data directory. What am I doing wrong?

Post by AndyMissed »

Holy smokes! I replaced "D:" with "__PATH__executable__" and Factorio launched! That was so simple... *Facepalm*

Thank you Factorio community for your helpful contributions! This issue is now solved.

posila
Factorio Staff
Factorio Staff
Posts: 5201
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: I can't change the data directory. What am I doing wrong?

Post by posila »

AndyMissed wrote: I then changed both "write-data=" and "read-data=" to have "D:\Games\Factorio" as their directory.
Don't change read-data path, leave it as read-data=__PATH__executable__\..\..\data

Also don't modify config-path.cfg. Steam will overwrite it on next update. Instead open Factorio properties in Steam and set launch option

Code: Select all

--config=D:\Games\Factorio\config\config.ini

AndyMissed
Burner Inserter
Burner Inserter
Posts: 12
Joined: Thu Feb 08, 2018 7:16 am
Contact:

Re: [Solved] Can't change the data directory.

Post by AndyMissed »

posila wrote:
AndyMissed wrote: I then changed both "write-data=" and "read-data=" to have "D:\Games\Factorio" as their directory.
Don't change read-data path, leave it as read-data=__PATH__executable__\..\..\data

Also don't modify config-path.cfg. Steam will overwrite it on next update. Instead open Factorio properties in Steam and set launch option

Code: Select all

--config=D:\Games\Factorio\config\config.ini
That's a useful piece of information. You're right. Thanks.

Steam is still insistent on putting my saves in the default directory, but that may be a separate issue. For now, I put a band-aid on that by creating a symbolic link in "C:\Users\(User)\AppData\Roaming\Factorio" called "saves" that links to "D:\Games\Factorio\saves" and it works fine.

Other than that, everything is good. Just needed to use __PATH__executable__ for the cfg and/or ini file.

Edit: Actually, you were right. I tested without __PATH__executable__, replaced them with "D:" and stated it as:

Code: Select all

read-data=D:\Program Files (x86)\Steam\steamapps\common\Factorio\data
Therefore restoring it to its 'original' state.

I was just being extremely dumb apparently. My bad. So there's no need to change the read-data for Steam users.

Jap2.0
Smart Inserter
Smart Inserter
Posts: 2339
Joined: Tue Jun 20, 2017 12:02 am
Contact:

Re: [Solved] Can't change the data directory.

Post by Jap2.0 »

Can you guys just add an option for this in-game? I had trouble figuring this out (I have no idea what I did that finally made it work), and I've seen various quesitons like it on here before. Furthermore it removes the need to play with the config, which I consider to be a benefit (no playing with config=no breaking config).
There are 10 types of people: those who get this joke and those who don't.

Zavian
Smart Inserter
Smart Inserter
Posts: 1641
Joined: Thu Mar 02, 2017 2:57 am
Contact:

Re: [Solved] Can't change the data directory.

Post by Zavian »

Jap2.0 wrote:Can you guys just add an option for this in-game? I had trouble figuring this out (I have no idea what I did that finally made it work), and I've seen various quesitons like it on here before. Furthermore it removes the need to play with the config, which I consider to be a benefit (no playing with config=no breaking config).
Well if you use the zip version everything is self contained, and you can put factorio wherever you want.

Jap2.0
Smart Inserter
Smart Inserter
Posts: 2339
Joined: Tue Jun 20, 2017 12:02 am
Contact:

Re: [Solved] Can't change the data directory.

Post by Jap2.0 »

Zavian wrote:
Jap2.0 wrote:Can you guys just add an option for this in-game? I had trouble figuring this out (I have no idea what I did that finally made it work), and I've seen various quesitons like it on here before. Furthermore it removes the need to play with the config, which I consider to be a benefit (no playing with config=no breaking config).
Well if you use the zip version everything is self contained, and you can put factorio wherever you want.
...but I don't. ;) And last I checked there were a couple other people who use Steam as well.
There are 10 types of people: those who get this joke and those who don't.

AndyMissed
Burner Inserter
Burner Inserter
Posts: 12
Joined: Thu Feb 08, 2018 7:16 am
Contact:

Re: [Solved] Can't change the data directory.

Post by AndyMissed »

Jap2.0 wrote:Can you guys just add an option for this in-game? I had trouble figuring this out (I have no idea what I did that finally made it work), and I've seen various quesitons like it on here before. Furthermore it removes the need to play with the config, which I consider to be a benefit (no playing with config=no breaking config).
I would agree, but I think generally the Factorio community knows what they're doing most of the time and are resourceful/intelligent enough to figure it out. Though having that option might be useful, nonetheless.

For now, I think I'm going to edit the main post with a summarization of how to do it properly with the Steam version.

Edit: I finished the "Summarization", but it turned into a guide... oh well.
Zavian wrote:(Snipped quote)

Well if you use the zip version everything is self contained, and you can put factorio wherever you want.
Some people like to keep track of their hours of life drained from Factorio. Others are just lazy, like me, and don't want to use the zip file. I'm a mix of both.
Jap2.0 wrote:(Super quote snip)

...but I don't. ;) And last I checked there were a couple other people who use Steam as well.
Just a couple? Not 125 million. 33 million daily active. But no, just a couple.

By far my most favorite understatement. I might quote you in my signature.

Jap2.0
Smart Inserter
Smart Inserter
Posts: 2339
Joined: Tue Jun 20, 2017 12:02 am
Contact:

Re: [Solved] Can't change the data directory.

Post by Jap2.0 »

AndyMissed wrote:
Jap2.0 wrote:Can you guys just add an option for this in-game? I had trouble figuring this out (I have no idea what I did that finally made it work), and I've seen various quesitons like it on here before. Furthermore it removes the need to play with the config, which I consider to be a benefit (no playing with config=no breaking config).
I would agree, but I think generally the Factorio community knows what they're doing most of the time and are resourceful/intelligent enough to figure it out. Though having that option might be useful, nonetheless.

For now, I think I'm going to edit the main post with a summarization of how to do it properly with the Steam version.

Edit: I finished the "Summarization", but it turned into a guide... oh well.
Can figure it out != Quick and easy to figure it out
AndyMissed wrote:Well if you use the zip version everything is self contained, and you can put factorio wherever you want.
Some people like to keep track of their hours of life drained from Factorio. Others are just lazy, like me, and don't want to use the zip file. I'm a mix of both.
Jap2.0 wrote:(Super quote snip)

...but I don't. ;) And last I checked there were a couple other people who use Steam as well.
Just a couple? Not 125 million. 33 million daily active. But no, just a couple.

By far my most favorite understatement. I might quote you in my signature.[/quote]

But less than 1% of those people played Factorio, so it's not that much of an understatement :P .
There are 10 types of people: those who get this joke and those who don't.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [Solved] Can't change the data directory.

Post by eradicator »

Just for reference because i forgot to ask:
What happens if you use steams built-in "move game to somewhere else" feature in the first place?

AndyMissed
Burner Inserter
Burner Inserter
Posts: 12
Joined: Thu Feb 08, 2018 7:16 am
Contact:

Re: [Solved] Can't change the data directory.

Post by AndyMissed »

eradicator wrote:Just for reference because i forgot to ask:
What happens if you use steams built-in "move game to somewhere else" feature in the first place?
I'm assuming you're talking about "Move Install Folder" under "Local Files" when in the properties tab? That just moves the files that Factorio reads from. Specifically what the "read-data=" is asking for. If I'm not mistaken.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [Solved] Can't change the data directory.

Post by eradicator »

AndyMissed wrote:
eradicator wrote:Just for reference because i forgot to ask:
What happens if you use steams built-in "move game to somewhere else" feature in the first place?
I'm assuming you're talking about "Move Install Folder" under "Local Files" when in the properties tab? That just moves the files that Factorio reads from. Specifically what the "read-data=" is asking for. If I'm not mistaken.
I think that's it yea. But isn't that exactly what you achived now? Moving the bulk data somewhere else while the saves need extra treatment.

AndyMissed
Burner Inserter
Burner Inserter
Posts: 12
Joined: Thu Feb 08, 2018 7:16 am
Contact:

Re: [Solved] Can't change the data directory.

Post by AndyMissed »

Jap2.0 wrote:But less than 1% of those people played Factorio, so it's not that much of an understatement :P .
Even 0.1% of 33 Million active users is still 30,000. And Factorio often has much more than 1,000 daily users. 1k users on any given day is usually a low day. Anyway, you get my point. lol.

Not trying to argue or anything by the way, just thought what you said was funny.

AndyMissed
Burner Inserter
Burner Inserter
Posts: 12
Joined: Thu Feb 08, 2018 7:16 am
Contact:

Re: [Solved] Can't change the data directory.

Post by AndyMissed »

eradicator wrote:
AndyMissed wrote:
eradicator wrote:Just for reference because i forgot to ask:
What happens if you use steams built-in "move game to somewhere else" feature in the first place?
I'm assuming you're talking about "Move Install Folder" under "Local Files" when in the properties tab? That just moves the files that Factorio reads from. Specifically what the "read-data=" is asking for. If I'm not mistaken.
I think that's it yea. But isn't that exactly what you achived now? Moving the bulk data somewhere else while the saves need extra treatment.
The short answer: No.

The long answer:
Factorio has two locations for its data when you install it through Steam:

Code: Select all

C:\Program Files (x86)\Steam\steamapps\common\Factorio
and:

Code: Select all

C:\Users\<Username>\AppData\Roaming\Factorio
However, the "Steam" folder can be set to a default location on any harddrive, therefore eliminating any need to move files, but since Factorio insists on putting all of its save data in the C drive, I had to do all of that stuff in the guide to move it somewhere else.

Save data consists of things like the mods folder, the saves folder, and the scenario folder. While the steamapp\common consists of everything else required to run the base game (read-data). And since I didn't want any data on my C drive, that's why I wanted to change it.

Does that make sense? They are two separate paths.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [Solved] Can't change the data directory.

Post by eradicator »

AndyMissed wrote: Does that make sense? They are two separate paths.
Well sure. I'll try to ask more precisely. From what i see the solution to the whole problem should be a simple process and not a hugely complicated task. So i must be mistaken somewhere, as in your solution you mix both of these. What i assumed you need to do:

Either:
  1. Use steam "move install folder" to move the bulk data.
  2. Move config to X:\???\writedata
  3. Create a symlink at C:\Users\<Username>\AppData\Roaming\Factorio to X:\???\writedata
  4. done.
Or:
  1. Use steam "move install folder" to move the bulk data.
  2. Move config to X:\???\writedata
  3. Change config write-data
  4. add --config to steam launch options
  5. done.
Neither of those steps requires editing config-path.cfg anymore. And the italic steps should be either or according to my understanding.

(Oh, and btw because i think nobody explained this. Two dots ("\..\") in paths means "one directory upwards", and one dot "\.\" means "this directory". So .\factorio\..\factorio would be the same as just C:\factorio if you started from C:)

AndyMissed
Burner Inserter
Burner Inserter
Posts: 12
Joined: Thu Feb 08, 2018 7:16 am
Contact:

Re: [Solved] Can't change the data directory.

Post by AndyMissed »

eradicator wrote:1. Use steam "move install folder" to move the bulk data.
"Move Install Folder" Is useless to me because the "bulk data" is already in the D drive since I told Steam that's where I wanted to put stuff. There's no need for that step.
eradicator wrote:1. Move config to X:\???\writedata
2. Create a symlink at C:\Users\<Username>\AppData\Roaming\Factorio to X:\???\writedata
3. done.
In order for that to work, you would have to move all the files out, not just the config. And then you would have to create a symlink called "Factorio" not "saves". Therefore, that's not technically changing the directory without changing the contents of config.ini.
eradicator wrote:1. Move config (And the entire contents of the Factorio folder) to X:\???\writedata
2. Change config write-data
3. add --config to steam launch options
4. done.
Which is what is supposed to work, right? Well, it doesn't. And I don't know why.

That solution works, up until the point where Steam decides to re-create the folders necessary to store all your saves from the cloud in "C:\Users\<Username>\AppData\Roaming\Factorio\saves". That is why I need to use symlink. But only for the saves folder.

Post Reply

Return to “Technical Help”