mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-14 22:38:34 +00:00
Fix last null terminator not being added to cia argv
This commit is contained in:
parent
756db4f264
commit
9e51d41fea
@ -173,23 +173,28 @@ int exec_cia(const char* path, const char* args){
|
||||
FSFILE_Close(ciaFile);
|
||||
FSUSER_CloseArchive(ciaArchive);
|
||||
|
||||
if(args == NULL || args[0] == '\0'){
|
||||
param.argc = 0;
|
||||
argsLength = 0;
|
||||
}
|
||||
else{
|
||||
param.argc = 0;
|
||||
argsLength = 0;
|
||||
if(args != NULL && args[0] != '\0'){
|
||||
bool inSingleQuotes = false;
|
||||
bool inDoubleQuotes = false;
|
||||
int argStringLength = strlen(args);
|
||||
param.argc = 0;
|
||||
argsLength = 0;
|
||||
|
||||
//build argument list like a terminal command on linux
|
||||
for(unsigned int argPtr = 0; argPtr < argStringLength; argPtr++){
|
||||
if(args[argPtr] == '\'')
|
||||
for(unsigned int argPtr = 0; argPtr <= argStringLength; argPtr++){
|
||||
if(args[argPtr] == '\''){
|
||||
inSingleQuotes = !inSingleQuotes;
|
||||
else if(args[argPtr] == '\"')
|
||||
}
|
||||
else if(args[argPtr] == '\"'){
|
||||
inDoubleQuotes = !inDoubleQuotes;
|
||||
}
|
||||
else if(args[argPtr] == '\0'){
|
||||
//last character in a valid arg string, end of last arg
|
||||
if(param.args[0] != '\0')
|
||||
param.argc++;
|
||||
param.args[argsLength] = args[argPtr];
|
||||
argsLength++;
|
||||
}
|
||||
else{
|
||||
if(!inSingleQuotes && !inDoubleQuotes && args[argPtr] == ' '){
|
||||
param.argc++;
|
||||
|
Loading…
Reference in New Issue
Block a user