Is one able to get the current project name using C++?

Hi,

I am currently in the middle of developing a WakaTime plugin for UE4. One of the optional data of the Heartbeat (something like a ping) is sending a project name. I would love to include this, but so far I have not been lucky in getting an answer to my question. Whenever I google it, I just get tons of “How to rename my project”, which does not help me in the slightest.

What I need is to be able to just get the project name. Getting the location of the file itself does not seem to be helpful, as the plugin seems to be running within the Engine binaries. Thank you for any tips.

Have a great day!

Hi @TheAshenWolf

const UGeneralProjectSettings& ProjectSettings = *GetDefault<UGeneralProjectSettings>();
UE_LOG(LogTemp, Log, TEXT("ProjectName: %s"), ProjectSettings.ProjectName);

*.Build.cs add EngineSettings module

If any problem let me know. My discord Andrew Bindraw #9014

Hi, your solution does compile when I add a missing asterisk in front of ProjectSettings.Project name,
(like this)

UE_LOG(LogTemp, Log, TEXT("ProjectName: %s"), *(ProjectSettings.ProjectName));

however, I am getting an empty string from it.

Edit: It was actually correct, I just did not have the project name set up in the project settings >.<
Thank you a lot!

#include “Misc/App.h”

UE_LOG(LogTemp, Log, TEXT("ProjectName: %s"), FApp::GetProjectName());
5 Likes