don't use base name it's destructive to the incoming string which you shouldn't modify as c_str() is const.
This commit is contained in:
		
							parent
							
								
									a3c9f53335
								
							
						
					
					
						commit
						27ae261d0e
					
				
					 1 changed files with 8 additions and 3 deletions
				
			
		| 
						 | 
					@ -101,7 +101,9 @@ void Config::readGameINI()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (!customScript.empty())
 | 
						if (!customScript.empty())
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		game.title = basename(customScript.c_str());
 | 
					        size_t pos = customScript.find_last_of("/\\");
 | 
				
			||||||
 | 
					        if (pos == customScript.npos) pos = 0;
 | 
				
			||||||
 | 
					        game.title = customScript.substr(pos);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -128,6 +130,9 @@ void Config::readGameINI()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	strReplace(game.scripts, '\\', '/');
 | 
						strReplace(game.scripts, '\\', '/');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (game.title.empty())
 | 
						if (game.title.empty()) {
 | 
				
			||||||
		game.title = basename(gameFolder.c_str());
 | 
					        size_t pos = gameFolder.find_last_of("/\\");
 | 
				
			||||||
 | 
					        if (pos == gameFolder.npos) pos = 0;
 | 
				
			||||||
 | 
					        game.title = gameFolder.substr(pos);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue