mirror of
				https://github.com/TES3MP/openmw-tes3mp.git
				synced 2025-10-31 17:26:42 +00:00 
			
		
		
		
	use converted widechars in ini importer
This commit is contained in:
		
							parent
							
								
									cd990a665a
								
							
						
					
					
						commit
						b4950509bc
					
				
					 2 changed files with 33 additions and 1 deletions
				
			
		|  | @ -4,11 +4,43 @@ | |||
| #include <string> | ||||
| #include <boost/program_options.hpp> | ||||
| #include <boost/filesystem.hpp> | ||||
| #include <boost/locale.hpp> | ||||
| 
 | ||||
| namespace bpo = boost::program_options; | ||||
| 
 | ||||
| #ifndef _WIN32 | ||||
| int main(int argc, char *argv[]) { | ||||
| #else | ||||
| 
 | ||||
| class utf8argv | ||||
| { | ||||
| public: | ||||
| 
 | ||||
|     utf8argv(int argc, wchar_t *wargv[]) | ||||
|     { | ||||
|         args.reserve(argc); | ||||
|         argv = new const char *[argc]; | ||||
| 
 | ||||
|         for (int i = 0; i < argc; ++i) { | ||||
|             args.push_back(boost::locale::conv::utf_to_utf<char>(wargv[i])); | ||||
|             argv[i] = args.back().c_str(); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     ~utf8argv() { delete[] argv; } | ||||
|     const char * const *get() const { return argv; } | ||||
| 
 | ||||
| private: | ||||
| 
 | ||||
|     const char **argv; | ||||
|     std::vector<std::string> args; | ||||
| }; | ||||
| 
 | ||||
| int wmain(int argc, wchar_t *wargv[]) { | ||||
|     utf8argv converter(argc, wargv); | ||||
|     char **argv = converter.get(); | ||||
|     boost::filesystem::path::imbue(boost::locale::generator().generate("")); | ||||
| #endif | ||||
|     bpo::options_description desc("Syntax: mwiniimporter <options> inifile configfile\nAllowed options"); | ||||
|     bpo::positional_options_description p_desc; | ||||
|     desc.add_options() | ||||
|  |  | |||
|  | @ -27,7 +27,7 @@ namespace Files | |||
| WindowsPath::WindowsPath(const std::string& application_name) | ||||
|     : mName(application_name) | ||||
| { | ||||
|     boost::filesystem::path::imbue(boost::locale::generator.generate("")); | ||||
|     boost::filesystem::path::imbue(boost::locale::generator().generate("")); | ||||
| } | ||||
| 
 | ||||
| boost::filesystem::path WindowsPath::getUserConfigPath() const | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue