Getwrappedlaunchdir ()
Start the working directory, because the working directory will be changed to the directory below the EXE, so the current cache will first
Fplatformprocess::basedir ()
This is the most basic, is the current EXE file directory.
is also the first to be calculated as a directory, because it is the root node of all dependencies, all the relative path to the full path is based on this directory
Fpaths::enginedir ()
Engine catalog, used to locate many of the built-in resources.
The default value is: /.. /.. /engine/, and the base directory is the basedir above.
Because in the post-release directory structure, the game directory and engine directory is the level of the top subdirectory, EXE file will be placed under the "Game Directory/binaries/win64/", back to three layers, just find engine
However, this directory can be used " Gforeignenginedir "to reload, as long as the default method does not find the engine directory (in the engine directory without binaries subdirectories), and Gforeignenginedir under the binaries
This is also the default configuration of the development phase, because the game is not packaged at this time, the game directory and the engine directory is not together, then only through the Gforeignenginedir to locate the engine
And what is the actual value of Gforeignenginedir at this time? In fact, it is defined by the macro that is passed in at compile time:
#if Platform_desktop #ifdef ue_engine_directory #define implement_foreign_engine_dir () Const TCHAR *gforeignenginedir = TEXT (preprocessor_to_string (ue_engine_directory)); #else #define Implement_foreign_engine_dir () const TCHAR *gforeignenginedir = nullptr; #endif #else #define #endif
Where Ue_engine_directory is set in UEBuildTarget.cs:
stringEnginepath = Utils.cleandirectoryseparators (Utils.makepathrelativeto (Projectfilegenerator.enginerelativepath, Path.getdirectoryname (Outputfilepath)),'/'); if(Enginepath.endswith ("/") ==false) {Enginepath+="/"; } GlobalCompileEnvironment.Config.Definitions.Add ("ue_engine_directory="+ Enginepath);
The call to Implement_foreign_engine_dir This macro appears in the UE4Game.cpp:
#if Is_monolithicper_module_boilerplatebooltrue; TCHAR ginternalgamename[] = TEXT (""); Implement_debuggame ()Implement_foreign_ Engine_dir()#endif
Fpaths::rootdir ()
root directory, but actually from the engine directory, that is, to find the "/engine" this paragraph to remove the previous layer
But what if there is no/engine in the engine catalog (it says it can be overloaded to a custom)?
Fpaths::gamedir ()
Game directory, the default is the engine directory sibling, named after the game name of the directory, but can also be overloaded with "Overridegamedir"
Originally is very simple, but look at the code derivation process is extremely complex, and the results are also very difficult to understand, obviously has been the most streamlined absolute path, can finally return unexpectedly is still a full. /relative path, also around several layers
+ Fpaths::gamecontentdir returned L ". /.. /.. /unrealengine/. /hz413/content/"Fstring &
These several "top-level" catalogs, each with their own computational logic.
In addition, some of the other directories are relatively simple, basically in Enginedir and Gamedir with the corresponding names of subdirectories,
as Gamecontentdir, Gameconfigdir, Gamesaveddir, Gameintermediatedir, and so on, each one also has a corresponding version of the engine.
Ue4 fpaths each directory