Perform chdir(gameFolder) early in main()
This commit is contained in:
		
							parent
							
								
									03a6c657c4
								
							
						
					
					
						commit
						fcfa079e7b
					
				
					 2 changed files with 8 additions and 11 deletions
				
			
		| 
						 | 
					@ -206,8 +206,15 @@ int main(int argc, char *argv[])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* now we load the config */
 | 
						/* now we load the config */
 | 
				
			||||||
	Config conf;
 | 
						Config conf;
 | 
				
			||||||
 | 
					 | 
				
			||||||
	conf.read(argc, argv);
 | 
						conf.read(argc, argv);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!conf.gameFolder.empty())
 | 
				
			||||||
 | 
							if (chdir(conf.gameFolder.c_str()) != 0)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								showInitError(std::string("Unable to switch into gameFolder ") + conf.gameFolder);
 | 
				
			||||||
 | 
								return 0;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	conf.readGameINI();
 | 
						conf.readGameINI();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	assert(conf.rgssVersion >= 1 && conf.rgssVersion <= 3);
 | 
						assert(conf.rgssVersion >= 1 && conf.rgssVersion <= 3);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -111,16 +111,6 @@ struct SharedStatePrivate
 | 
				
			||||||
	      fontState(threadData->config),
 | 
						      fontState(threadData->config),
 | 
				
			||||||
	      stampCounter(0)
 | 
						      stampCounter(0)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if (!config.gameFolder.empty())
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			int result = chdir(config.gameFolder.c_str());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			if (result != 0)
 | 
					 | 
				
			||||||
				throw Exception(Exception::MKXPError,
 | 
					 | 
				
			||||||
			                    "Unable to switch into gameFolder '%s'",
 | 
					 | 
				
			||||||
			                    config.gameFolder.c_str());
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		// FIXME find out correct archive filename
 | 
							// FIXME find out correct archive filename
 | 
				
			||||||
		std::string archPath = defGameArchive();
 | 
							std::string archPath = defGameArchive();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue