mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +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);
|
FSFILE_Close(ciaFile);
|
||||||
FSUSER_CloseArchive(ciaArchive);
|
FSUSER_CloseArchive(ciaArchive);
|
||||||
|
|
||||||
if(args == NULL || args[0] == '\0'){
|
param.argc = 0;
|
||||||
param.argc = 0;
|
argsLength = 0;
|
||||||
argsLength = 0;
|
if(args != NULL && args[0] != '\0'){
|
||||||
}
|
|
||||||
else{
|
|
||||||
bool inSingleQuotes = false;
|
bool inSingleQuotes = false;
|
||||||
bool inDoubleQuotes = false;
|
bool inDoubleQuotes = false;
|
||||||
int argStringLength = strlen(args);
|
int argStringLength = strlen(args);
|
||||||
param.argc = 0;
|
|
||||||
argsLength = 0;
|
|
||||||
|
|
||||||
//build argument list like a terminal command on linux
|
//build argument list like a terminal command on linux
|
||||||
for(unsigned int argPtr = 0; argPtr < argStringLength; argPtr++){
|
for(unsigned int argPtr = 0; argPtr <= argStringLength; argPtr++){
|
||||||
if(args[argPtr] == '\'')
|
if(args[argPtr] == '\''){
|
||||||
inSingleQuotes = !inSingleQuotes;
|
inSingleQuotes = !inSingleQuotes;
|
||||||
else if(args[argPtr] == '\"')
|
}
|
||||||
|
else if(args[argPtr] == '\"'){
|
||||||
inDoubleQuotes = !inDoubleQuotes;
|
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{
|
else{
|
||||||
if(!inSingleQuotes && !inDoubleQuotes && args[argPtr] == ' '){
|
if(!inSingleQuotes && !inDoubleQuotes && args[argPtr] == ' '){
|
||||||
param.argc++;
|
param.argc++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user