In LaunchAndroid.cpp InitCommandLine(). We want to be able to see if it’s a build made by the project launcher. Because the CommandLine will be in different locations depending on if it’s made by project launcher and the version of our game. We have essentially split our game into two apps.
In other parts of the project we see if it’s a projectlauncher build and what version it is through the Command line.
Hi Aron,
Your best bet to differentiate between project launcher and installed build would be to create a custom project launcher profile and add additional command line parameter such -LaunchedFromProjectLauncher. You can then check that argument in your application runtime code ( if(FParse::Param(FCommandLine::Get(), TEXT(“LaunchedFromProjectLauncher”))) and alter its behaviour as needed. You could also modify the UE4 Project Launcher code to add this argument by default.
Best regards
Hi Aron,
Can you clarify what you mean by ‘we cannot access the commandline since it has not been set yet’? Are you talking about the ComandLine.txt file? Can you also clarify ‘We can access the CommandLine while the build is being deployed.’? Do you mean you’d like to inject parameters to the CommandLine file during build generation?
Best regards.
Hello! Thanks for a quick answer!
Yes we have added this already but specificly in LaunchAndroid.cpp InitCommandLine(), we cannot access the commandline since it has not been set yet 
We can access the CommandLine while the build is being deployed. Maybe there is a way to something there?
I’ll add the code snippet! Maybe I am missunderstanding. But we are changing the folder location depending on what version of the app it is but only if it’s a project launcher build. But in InitCommandLine() in LaunchAndroid.cpp, they set what filepath the CommandLine is at. But we need to Append “/UE4Game/” with our appversion (if it’s a projectlauncher build). So it’s in this part of the logic we need to know if it’s a project launcher build, and the commandline itself will be in different locations depending on if it’s a projectlauncher build.
When it comes to accessing the CommandLine while the build is being deployed. In AndroidPlatform.Automation.cs we can access the commandLine and through that check if it’s a projectLauncher build 
I hope this makes sense
thank you for your patience
`static void InitCommandLine()
{
static const uint32 CMD_LINE_MAX = 16384u;
// initialize the command line to an empty string
FCommandLine::Set(TEXT(“”));
AAssetManager* AssetMgr = AndroidThunkCpp_GetAssetManager();
AAsset* asset = AAssetManager_open(AssetMgr, TCHAR_TO_UTF8(TEXT(“UE4CommandLine.txt”)), AASSET_MODE_BUFFER);
if (nullptr != asset)
{
const void* FileContents = AAsset_getBuffer(asset);
int32 FileLength = AAsset_getLength(asset);
char CommandLine[CMD_LINE_MAX];
FileLength = (FileLength < CMD_LINE_MAX - 1) ? FileLength : CMD_LINE_MAX - 1;
memcpy(CommandLine, FileContents, FileLength);
CommandLine[FileLength] = ‘\0’;
AAsset_close(asset);
// chop off trailing spaces
while (*CommandLine && isspace(CommandLine[strlen(CommandLine) - 1]))
{
CommandLine[strlen(CommandLine) - 1] = 0;
}
FCommandLine::Append(UTF8_TO_TCHAR(CommandLine));
FPlatformMisc::LowLevelOutputDebugStringf(TEXT(“APK Commandline: %s”), FCommandLine::Get());
}
// read in the command line text file from the sdcard if it exists
////////////////// We need to append /UE4Game/ with the app name depending on what version it is
FString CommandLineFilePath = GFilePathBase + FString(“/UE4Game/”) + (!FApp::IsProjectNameEmpty() ? FApp::GetProjectName() : FPlatformProcess::ExecutableName()) + FString(“/UE4CommandLine.txt”);
//////////////////////////////////////////////////////////////////////////////////////////////`
Hi Aron,
If UE4CommandLine.txt is opened via AAssetManager_open, this is indicative that the data has been packaged in the APK, whereal if it is loaded from external storage, this is indicative of a free file deploy from editor with the “package assets in APK” disabled. You can use this as a differentiator of builds if it suits your needs.
Best regards.
I’ll add the code snippet! Maybe I am missunderstanding. But we are changing the folder location depending on what version of the app it is but only if it’s a project launcher build. But in InitCommandLine() in LaunchAndroid.cpp, they set what filepath the CommandLine is at. But we need to Append “/UE4Game/” with our appversion (if it’s a projectlauncher build). So it’s in this part of the logic we need to know if it’s a project launcher build, and the commandline itself will be in different locations depending on if it’s a projectlauncher build.
When it comes to accessing the CommandLine while the build is being deployed. In AndroidPlatform.Automation.cs we can access the commandLine and through that check if it’s a projectLauncher build 
I hope this makes sense
thank you for your patience
`static void InitCommandLine()
{
static const uint32 CMD_LINE_MAX = 16384u;
// initialize the command line to an empty string
FCommandLine::Set(TEXT(“”));
AAssetManager* AssetMgr = AndroidThunkCpp_GetAssetManager();
AAsset* asset = AAssetManager_open(AssetMgr, TCHAR_TO_UTF8(TEXT(“UE4CommandLine.txt”)), AASSET_MODE_BUFFER);
if (nullptr != asset)
{
const void* FileContents = AAsset_getBuffer(asset);
int32 FileLength = AAsset_getLength(asset);
char CommandLine[CMD_LINE_MAX];
FileLength = (FileLength < CMD_LINE_MAX - 1) ? FileLength : CMD_LINE_MAX - 1;
memcpy(CommandLine, FileContents, FileLength);
CommandLine[FileLength] = ‘\0’;
AAsset_close(asset);
// chop off trailing spaces
while (*CommandLine && isspace(CommandLine[strlen(CommandLine) - 1]))
{
CommandLine[strlen(CommandLine) - 1] = 0;
}
FCommandLine::Append(UTF8_TO_TCHAR(CommandLine));
FPlatformMisc::LowLevelOutputDebugStringf(TEXT(“APK Commandline: %s”), FCommandLine::Get());
}
// read in the command line text file from the sdcard if it exists
////////////////// We need to append /UE4Game/ with the app name depending on what version it is
FString CommandLineFilePath = GFilePathBase + FString(“/UE4Game/”) + (!FApp::IsProjectNameEmpty() ? FApp::GetProjectName() : FPlatformProcess::ExecutableName()) + FString(“/UE4CommandLine.txt”);
//////////////////////////////////////////////////////////////////////////////////////////////`
Hi Aron,
If UE4CommandLine.txt is opened via AAssetManager_open, this is indicative that the data has been packaged in the APK, whereal if it is loaded from external storage, this is indicative of a free file deploy from editor with the “package assets in APK” disabled. You can use this as a differentiator of builds if it suits your needs.
Best regards.
I’ll add the code snippet! Maybe I am missunderstanding. But we are changing the folder location depending on what version of the app it is but only if it’s a project launcher build. But in InitCommandLine() in LaunchAndroid.cpp, they set what filepath the CommandLine is at. But we need to Append “/UE4Game/” with our appversion (if it’s a projectlauncher build). So it’s in this part of the logic we need to know if it’s a project launcher build, and the commandline itself will be in different locations depending on if it’s a projectlauncher build.
When it comes to accessing the CommandLine while the build is being deployed. In AndroidPlatform.Automation.cs we can access the commandLine and through that check if it’s a projectLauncher build 
I hope this makes sense
thank you for your patience
`static void InitCommandLine()
{
static const uint32 CMD_LINE_MAX = 16384u;
// initialize the command line to an empty string
FCommandLine::Set(TEXT(“”));
AAssetManager* AssetMgr = AndroidThunkCpp_GetAssetManager();
AAsset* asset = AAssetManager_open(AssetMgr, TCHAR_TO_UTF8(TEXT(“UE4CommandLine.txt”)), AASSET_MODE_BUFFER);
if (nullptr != asset)
{
const void* FileContents = AAsset_getBuffer(asset);
int32 FileLength = AAsset_getLength(asset);
char CommandLine[CMD_LINE_MAX];
FileLength = (FileLength < CMD_LINE_MAX - 1) ? FileLength : CMD_LINE_MAX - 1;
memcpy(CommandLine, FileContents, FileLength);
CommandLine[FileLength] = ‘\0’;
AAsset_close(asset);
// chop off trailing spaces
while (*CommandLine && isspace(CommandLine[strlen(CommandLine) - 1]))
{
CommandLine[strlen(CommandLine) - 1] = 0;
}
FCommandLine::Append(UTF8_TO_TCHAR(CommandLine));
FPlatformMisc::LowLevelOutputDebugStringf(TEXT(“APK Commandline: %s”), FCommandLine::Get());
}
// read in the command line text file from the sdcard if it exists
////////////////// We need to append /UE4Game/ with the app name depending on what version it is
FString CommandLineFilePath = GFilePathBase + FString(“/UE4Game/”) + (!FApp::IsProjectNameEmpty() ? FApp::GetProjectName() : FPlatformProcess::ExecutableName()) + FString(“/UE4CommandLine.txt”);
//////////////////////////////////////////////////////////////////////////////////////////////`
Hi Aron,
If UE4CommandLine.txt is opened via AAssetManager_open, this is indicative that the data has been packaged in the APK, whereal if it is loaded from external storage, this is indicative of a free file deploy from editor with the “package assets in APK” disabled. You can use this as a differentiator of builds if it suits your needs.
Best regards.
I’ll add the code snippet! Maybe I am missunderstanding. But we are changing the folder location depending on what version of the app it is but only if it’s a project launcher build. But in InitCommandLine() in LaunchAndroid.cpp, they set what filepath the CommandLine is at. But we need to Append “/UE4Game/” with our appversion (if it’s a projectlauncher build). So it’s in this part of the logic we need to know if it’s a project launcher build, and the commandline itself will be in different locations depending on if it’s a projectlauncher build.
When it comes to accessing the CommandLine while the build is being deployed. In AndroidPlatform.Automation.cs we can access the commandLine and through that check if it’s a projectLauncher build 
I hope this makes sense
thank you for your patience
`static void InitCommandLine()
{
static const uint32 CMD_LINE_MAX = 16384u;
// initialize the command line to an empty string
FCommandLine::Set(TEXT(“”));
AAssetManager* AssetMgr = AndroidThunkCpp_GetAssetManager();
AAsset* asset = AAssetManager_open(AssetMgr, TCHAR_TO_UTF8(TEXT(“UE4CommandLine.txt”)), AASSET_MODE_BUFFER);
if (nullptr != asset)
{
const void* FileContents = AAsset_getBuffer(asset);
int32 FileLength = AAsset_getLength(asset);
char CommandLine[CMD_LINE_MAX];
FileLength = (FileLength < CMD_LINE_MAX - 1) ? FileLength : CMD_LINE_MAX - 1;
memcpy(CommandLine, FileContents, FileLength);
CommandLine[FileLength] = ‘\0’;
AAsset_close(asset);
// chop off trailing spaces
while (*CommandLine && isspace(CommandLine[strlen(CommandLine) - 1]))
{
CommandLine[strlen(CommandLine) - 1] = 0;
}
FCommandLine::Append(UTF8_TO_TCHAR(CommandLine));
FPlatformMisc::LowLevelOutputDebugStringf(TEXT(“APK Commandline: %s”), FCommandLine::Get());
}
// read in the command line text file from the sdcard if it exists
////////////////// We need to append /UE4Game/ with the app name depending on what version it is
FString CommandLineFilePath = GFilePathBase + FString(“/UE4Game/”) + (!FApp::IsProjectNameEmpty() ? FApp::GetProjectName() : FPlatformProcess::ExecutableName()) + FString(“/UE4CommandLine.txt”);
//////////////////////////////////////////////////////////////////////////////////////////////`
Hi Aron,
If UE4CommandLine.txt is opened via AAssetManager_open, this is indicative that the data has been packaged in the APK, whereal if it is loaded from external storage, this is indicative of a free file deploy from editor with the “package assets in APK” disabled. You can use this as a differentiator of builds if it suits your needs.
Best regards.
Hi Aron,
If UE4CommandLine.txt is opened via AAssetManager_open, this is indicative that the data has been packaged in the APK, whereal if it is loaded from external storage, this is indicative of a free file deploy from editor with the “package assets in APK” disabled. You can use this as a differentiator of builds if it suits your needs.
Best regards.
I’ll add the code snippet! Maybe I am missunderstanding. But we are changing the folder location depending on what version of the app it is but only if it’s a project launcher build. But in InitCommandLine() in LaunchAndroid.cpp, they set what filepath the CommandLine is at. But we need to Append “/UE4Game/” with our appversion (if it’s a projectlauncher build). So it’s in this part of the logic we need to know if it’s a project launcher build, and the commandline itself will be in different locations depending on if it’s a projectlauncher build.
When it comes to accessing the CommandLine while the build is being deployed. In AndroidPlatform.Automation.cs we can access the commandLine and through that check if it’s a projectLauncher build 
I hope this makes sense
thank you for your patience
`static void InitCommandLine()
{
static const uint32 CMD_LINE_MAX = 16384u;
// initialize the command line to an empty string
FCommandLine::Set(TEXT(“”));
AAssetManager* AssetMgr = AndroidThunkCpp_GetAssetManager();
AAsset* asset = AAssetManager_open(AssetMgr, TCHAR_TO_UTF8(TEXT(“UE4CommandLine.txt”)), AASSET_MODE_BUFFER);
if (nullptr != asset)
{
const void* FileContents = AAsset_getBuffer(asset);
int32 FileLength = AAsset_getLength(asset);
char CommandLine[CMD_LINE_MAX];
FileLength = (FileLength < CMD_LINE_MAX - 1) ? FileLength : CMD_LINE_MAX - 1;
memcpy(CommandLine, FileContents, FileLength);
CommandLine[FileLength] = ‘\0’;
AAsset_close(asset);
// chop off trailing spaces
while (*CommandLine && isspace(CommandLine[strlen(CommandLine) - 1]))
{
CommandLine[strlen(CommandLine) - 1] = 0;
}
FCommandLine::Append(UTF8_TO_TCHAR(CommandLine));
FPlatformMisc::LowLevelOutputDebugStringf(TEXT(“APK Commandline: %s”), FCommandLine::Get());
}
// read in the command line text file from the sdcard if it exists
////////////////// We need to append /UE4Game/ with the app name depending on what version it is
FString CommandLineFilePath = GFilePathBase + FString(“/UE4Game/”) + (!FApp::IsProjectNameEmpty() ? FApp::GetProjectName() : FPlatformProcess::ExecutableName()) + FString(“/UE4CommandLine.txt”);
//////////////////////////////////////////////////////////////////////////////////////////////`
Hi Aron,
If UE4CommandLine.txt is opened via AAssetManager_open, this is indicative that the data has been packaged in the APK, whereal if it is loaded from external storage, this is indicative of a free file deploy from editor with the “package assets in APK” disabled. You can use this as a differentiator of builds if it suits your needs.
Best regards.
I’ll add the code snippet! Maybe I am missunderstanding. But we are changing the folder location depending on what version of the app it is but only if it’s a project launcher build. But in InitCommandLine() in LaunchAndroid.cpp, they set what filepath the CommandLine is at. But we need to Append “/UE4Game/” with our appversion (if it’s a projectlauncher build). So it’s in this part of the logic we need to know if it’s a project launcher build, and the commandline itself will be in different locations depending on if it’s a projectlauncher build.
When it comes to accessing the CommandLine while the build is being deployed. In AndroidPlatform.Automation.cs we can access the commandLine and through that check if it’s a projectLauncher build 
I hope this makes sense
thank you for your patience
`static void InitCommandLine()
{
static const uint32 CMD_LINE_MAX = 16384u;
// initialize the command line to an empty string
FCommandLine::Set(TEXT(“”));
AAssetManager* AssetMgr = AndroidThunkCpp_GetAssetManager();
AAsset* asset = AAssetManager_open(AssetMgr, TCHAR_TO_UTF8(TEXT(“UE4CommandLine.txt”)), AASSET_MODE_BUFFER);
if (nullptr != asset)
{
const void* FileContents = AAsset_getBuffer(asset);
int32 FileLength = AAsset_getLength(asset);
char CommandLine[CMD_LINE_MAX];
FileLength = (FileLength < CMD_LINE_MAX - 1) ? FileLength : CMD_LINE_MAX - 1;
memcpy(CommandLine, FileContents, FileLength);
CommandLine[FileLength] = ‘\0’;
AAsset_close(asset);
// chop off trailing spaces
while (*CommandLine && isspace(CommandLine[strlen(CommandLine) - 1]))
{
CommandLine[strlen(CommandLine) - 1] = 0;
}
FCommandLine::Append(UTF8_TO_TCHAR(CommandLine));
FPlatformMisc::LowLevelOutputDebugStringf(TEXT(“APK Commandline: %s”), FCommandLine::Get());
}
// read in the command line text file from the sdcard if it exists
////////////////// We need to append /UE4Game/ with the app name depending on what version it is
FString CommandLineFilePath = GFilePathBase + FString(“/UE4Game/”) + (!FApp::IsProjectNameEmpty() ? FApp::GetProjectName() : FPlatformProcess::ExecutableName()) + FString(“/UE4CommandLine.txt”);
//////////////////////////////////////////////////////////////////////////////////////////////`
I’ll add the code snippet! Maybe I am missunderstanding. But we are changing the folder location depending on what version of the app it is but only if it’s a project launcher build. But in InitCommandLine() in LaunchAndroid.cpp, they set what filepath the CommandLine is at. But we need to Append “/UE4Game/” with our appversion (if it’s a projectlauncher build). So it’s in this part of the logic we need to know if it’s a project launcher build, and the commandline itself will be in different locations depending on if it’s a projectlauncher build.
When it comes to accessing the CommandLine while the build is being deployed. In AndroidPlatform.Automation.cs we can access the commandLine and through that check if it’s a projectLauncher build 
I hope this makes sense
thank you for your patience
`static void InitCommandLine()
{
static const uint32 CMD_LINE_MAX = 16384u;
// initialize the command line to an empty string
FCommandLine::Set(TEXT(“”));
AAssetManager* AssetMgr = AndroidThunkCpp_GetAssetManager();
AAsset* asset = AAssetManager_open(AssetMgr, TCHAR_TO_UTF8(TEXT(“UE4CommandLine.txt”)), AASSET_MODE_BUFFER);
if (nullptr != asset)
{
const void* FileContents = AAsset_getBuffer(asset);
int32 FileLength = AAsset_getLength(asset);
char CommandLine[CMD_LINE_MAX];
FileLength = (FileLength < CMD_LINE_MAX - 1) ? FileLength : CMD_LINE_MAX - 1;
memcpy(CommandLine, FileContents, FileLength);
CommandLine[FileLength] = ‘\0’;
AAsset_close(asset);
// chop off trailing spaces
while (*CommandLine && isspace(CommandLine[strlen(CommandLine) - 1]))
{
CommandLine[strlen(CommandLine) - 1] = 0;
}
FCommandLine::Append(UTF8_TO_TCHAR(CommandLine));
FPlatformMisc::LowLevelOutputDebugStringf(TEXT(“APK Commandline: %s”), FCommandLine::Get());
}
// read in the command line text file from the sdcard if it exists
////////////////// We need to append /UE4Game/ with the app name depending on what version it is
FString CommandLineFilePath = GFilePathBase + FString(“/UE4Game/”) + (!FApp::IsProjectNameEmpty() ? FApp::GetProjectName() : FPlatformProcess::ExecutableName()) + FString(“/UE4CommandLine.txt”);
//////////////////////////////////////////////////////////////////////////////////////////////`
Hi Aron,
If UE4CommandLine.txt is opened via AAssetManager_open, this is indicative that the data has been packaged in the APK, whereal if it is loaded from external storage, this is indicative of a free file deploy from editor with the “package assets in APK” disabled. You can use this as a differentiator of builds if it suits your needs.
Best regards.
I’ll add the code snippet! Maybe I am missunderstanding. But we are changing the folder location depending on what version of the app it is but only if it’s a project launcher build. But in InitCommandLine() in LaunchAndroid.cpp, they set what filepath the CommandLine is at. But we need to Append “/UE4Game/” with our appversion (if it’s a projectlauncher build). So it’s in this part of the logic we need to know if it’s a project launcher build, and the commandline itself will be in different locations depending on if it’s a projectlauncher build.
When it comes to accessing the CommandLine while the build is being deployed. In AndroidPlatform.Automation.cs we can access the commandLine and through that check if it’s a projectLauncher build 
I hope this makes sense
thank you for your patience
`static void InitCommandLine()
{
static const uint32 CMD_LINE_MAX = 16384u;
// initialize the command line to an empty string
FCommandLine::Set(TEXT(“”));
AAssetManager* AssetMgr = AndroidThunkCpp_GetAssetManager();
AAsset* asset = AAssetManager_open(AssetMgr, TCHAR_TO_UTF8(TEXT(“UE4CommandLine.txt”)), AASSET_MODE_BUFFER);
if (nullptr != asset)
{
const void* FileContents = AAsset_getBuffer(asset);
int32 FileLength = AAsset_getLength(asset);
char CommandLine[CMD_LINE_MAX];
FileLength = (FileLength < CMD_LINE_MAX - 1) ? FileLength : CMD_LINE_MAX - 1;
memcpy(CommandLine, FileContents, FileLength);
CommandLine[FileLength] = ‘\0’;
AAsset_close(asset);
// chop off trailing spaces
while (*CommandLine && isspace(CommandLine[strlen(CommandLine) - 1]))
{
CommandLine[strlen(CommandLine) - 1] = 0;
}
FCommandLine::Append(UTF8_TO_TCHAR(CommandLine));
FPlatformMisc::LowLevelOutputDebugStringf(TEXT(“APK Commandline: %s”), FCommandLine::Get());
}
// read in the command line text file from the sdcard if it exists
////////////////// We need to append /UE4Game/ with the app name depending on what version it is
FString CommandLineFilePath = GFilePathBase + FString(“/UE4Game/”) + (!FApp::IsProjectNameEmpty() ? FApp::GetProjectName() : FPlatformProcess::ExecutableName()) + FString(“/UE4CommandLine.txt”);
//////////////////////////////////////////////////////////////////////////////////////////////`
Hi Aron,
If UE4CommandLine.txt is opened via AAssetManager_open, this is indicative that the data has been packaged in the APK, whereal if it is loaded from external storage, this is indicative of a free file deploy from editor with the “package assets in APK” disabled. You can use this as a differentiator of builds if it suits your needs.
Best regards.