Setup
Platform-Specific Paths
EFM provides several utility functions to get common directories. Use these to ensure your paths work across platforms:
| Function | Returns |
|---|---|
GetGameSavedDirectory() | YourProject/Saved/ |
GetGameContentDirectory() | YourProject/Content/ |
GetGameExecutableDirectory() | YourProject/Binaries/PLATFORM/ |
GetGameDirectoryRoot() | Platform-specific game root |
GetGameUprojectRoot() | YourProject.uproject path |
Best Practice: Always use GetGameSavedDirectory() for runtime writes
// Correct - writes to Saved/
SaveDir = GetGameSavedDirectory() + "MyGame/"
CreateDirectory(SaveDir)
// Avoid - hardcoded paths may not work on all platforms
SaveDir = "C:/Users/..."
Path Utilities
EFM provides comprehensive path manipulation functions:
// Normalize path separators for current platform
Normalized = NormalizePath("C:/some\\path/file.txt")
// Convert relative to absolute
Absolute = GetAbsolutePath("Saved/Config/file.ini")
// Convert absolute to relative
Relative = GetRelativePath("C:/Project/Saved/file.ini", "C:/Project/")
// Combine multiple path segments
FullPath = CombinePaths(["C:", "Project", "Saved", "file.ini"])
// Get parent directory
Parent = GetParentDirectory("C:/Project/Saved/Config/file.ini")
// Change extension
NewPath = ChangePathExtension("file.txt", "json")
// Remove extension
NoExt = RemovePathExtension("file.txt")
// Check if path is absolute
IsAbs = IsAbsolutePath("C:/Project/Saved/")
// Validate path
IsValid = IsPathValid("C:/Valid/Path")
File Types and Extensions
Use GetExtensionFromString() to extract file extensions:
Ext = GetExtensionFromString("C:/path/to/file.json")
// Returns: "json"
Diagnostics
Run the built-in diagnostic function to verify all EFM functions work correctly:
RunEFMDiagnostics()
This tests every function and logs pass/fail results to the Output Log. Use this:
- After installation to verify everything works
- After engine upgrades to catch breaking changes
- When debugging file operation issues
Recommended Project Structure
YourProject/
├── Config/
│ └── DefaultGame.ini # Store game config here
├── Content/
│ └── ...
├── Saved/
│ ├── MyGame/ # Your game's runtime data
│ │ ├── Saves/ # Save files
│ │ ├── Config/ # Runtime config
│ │ ├── Downloads/ # Downloaded content
│ │ └── Logs/ # Game logs
│ └── ...
└── Plugins/
└── EFM/
Create these directories at game startup:
SavedDir = GetGameSavedDirectory() + "MyGame/"
CreateDirectoryTree(SavedDir + "Saves/")
CreateDirectoryTree(SavedDir + "Config/")
CreateDirectoryTree(SavedDir + "Downloads/")
CreateDirectoryTree(SavedDir + "Logs/")