From Europa Universalis 2 Wiki
Jump to navigation Jump to search

Moddir is a function of EU2 that allows the user to specify a directory to EU2 for it to look for its many data files in. Moddir was added as a feature in EU2 1.05, so you cannot use it without patching EU2. since version 1.05. It allows you to specify a certain directory to start EU2 in. This is almost only used by mods. All of the popular EU2 mods now use moddir.

When you've run EU2 with a moddir, it does not mean that the normal EU2 directory is not used. Rather, what happens is that when EU2 searches for files to be used in a game, it first searches for a filename in the mods directory. If it finds a file there with the right name, it uses it (and that file must use the same encoding for information as the vanilla file does, or you may get a crash). If EU2 does not find a version there, then it will use the vanilla file from the normal directory.

Normal EU2 Operation

When you are running vanilla EU2, if you accepted the default install location, you have it installed in directory:

C:\Games\Europa Universalis II\

That is the main install directory.

The shortcut on your desktop contains:

C:\Games\Europa Universalis II\EU2.EXE.

Data files such as province.csv are located beneath the main install directory, in various places. (See the article on file structure.) When EU2 goes to look for one, it looks for it relative to the main install directory. For example, when it looks for province.csv, it knows that province.csv is supposed to be in the "DB" directory, beneath the main EU2 directory. So it looks in:


(The "." is computerese for "current working directory"). Since the current working directory is EU2's main install directory, the file must be in:

C:\Games\Europa Universalis II\DB\province.csv

And that is where province.csv is.

Running EU2 with moddir

To run EU2 with a moddir, you must make give EU2 an "argument", as they are called in computerese. Which is just to say, that you give extra information to EU2 when it starts up. The argument is a string, which for moddir, must either be a full path to the directory you want to use, or a relative path from EU2's install directory.

For example, the normal way to install AGCEEP is to put its directory beneath the main EU2 directory. That is, you install it to:

C:\Games\Europa Universalis II\AGCEEP

To run any mod, you run EU2, but you give it the moddir on the command line. For example, the shortcut for AGCEEP on your desktop contains:

C:\Games\Europa Universalis II\EU2.EXE C:\Games\Europa Universalis II\AGCEEP.

Since AGCEEP is installed beneath EU2, the full path can be skipped, and the shortcut could also be this:

C:\Games\Europa Universalis II\EU2.EXE AGCEEP .

Continuing the example of ACGEEP, what happens when EU2 wants to read province.csv to initialize provinces? What is does is first take the moddir, and construct a place to look for the file using it. In this case, the moddir is "C:\Games\Europa Universalis II\AGCEEP", and the path to province.csv is ".\DB\province.csv". So EU2 splices the strings together and gets:

C:\Games\Europa Universalis II\ACGEEP\DB\province.csv

And it finds the modified province.csv that has been installed there.