mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 12:11:15 -06:00 
			
		
		
		
	SendSystemInfo: Trim leading/trailing whitespace from all the values
This commit is contained in:
		
							parent
							
								
									ea25461a95
								
							
						
					
					
						commit
						8d115def76
					
				
					 1 changed files with 13 additions and 5 deletions
				
			
		|  | @ -436,15 +436,23 @@ static std::string generate_system_info_json() | |||
|     pt::ptree root; | ||||
|     root.add_child("data", data_node); | ||||
| 
 | ||||
|     // Now go through all the values and trim leading/trailing whitespace.
 | ||||
|     // Some CPU names etc apparently have trailing spaces...
 | ||||
|     std::function<void(pt::ptree&)> remove_whitespace; | ||||
|     remove_whitespace = [&remove_whitespace](pt::ptree& t) -> void | ||||
|     { | ||||
|         if (t.empty()) // Trim whitespace
 | ||||
|             boost::algorithm::trim(t.data()); | ||||
|         else | ||||
|             for (auto it = t.begin(); it != t.end(); ++it) | ||||
|                 remove_whitespace(it->second); | ||||
|     }; | ||||
|     remove_whitespace(root); | ||||
| 
 | ||||
|     // Serialize the tree into JSON and return it.
 | ||||
|     std::stringstream ss; | ||||
|     pt::write_json(ss, root); | ||||
|     return ss.str(); | ||||
| 
 | ||||
|     // FURTHER THINGS TO CONSIDER:
 | ||||
|     //std::cout << wxPlatformInfo::Get().GetOperatingSystemFamilyName() << std::endl;          // Unix
 | ||||
|     // ? CPU, GPU, UNKNOWN ?
 | ||||
|     // printers? will they be installed already?
 | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lukas Matena
						Lukas Matena