Skip to content

Commit

Permalink
Get absolute path of the project
Browse files Browse the repository at this point in the history
  • Loading branch information
rajat2004 committed Mar 4, 2021
1 parent 6c81440 commit 0cec4f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Unreal/Plugins/AirSim/Source/SimHUD/SimHUD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,11 @@ void ASimHUD::initializeSubWindows()

}


FString ASimHUD::getAbsProjectDir()
{
FString project_rel_path = FPaths::ProjectDir();
return IFileManager::Get().ConvertToAbsolutePathForExternalAppForRead(*project_rel_path);
}

// Attempts to parse the settings text from one of multiple locations.
// First, check the command line for settings provided via "-s" or "--settings" arguments
Expand All @@ -368,7 +372,7 @@ bool ASimHUD::getSettingsText(std::string& settingsText)
||
readSettingsTextFromFile(FString(msr::airlib::Settings::getExecutableFullPath("settings.json").c_str()), settingsText)
||
readSettingsTextFromFile(FPaths::Combine(FPaths::ProjectDir(), FString("settings.json")), settingsText)
readSettingsTextFromFile(FPaths::Combine(getAbsProjectDir(), FString("settings.json")), settingsText)
||
readSettingsTextFromFile(FString(msr::airlib::Settings::Settings::getUserDirectoryFullPath("settings.json").c_str()), settingsText));
}
Expand Down
2 changes: 2 additions & 0 deletions Unreal/Plugins/AirSim/Source/SimHUD/SimHUD.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class AIRSIM_API ASimHUD : public AHUD
bool readSettingsTextFromFile(const FString& fileName, std::string& settingsText);
std::string getSimModeFromUser();

static FString getAbsProjectDir();

private:
typedef common_utils::Utils Utils;
UClass* widget_class_;
Expand Down

0 comments on commit 0cec4f6

Please sign in to comment.