mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	fix: fail if neither HOME nor XDG_STATE_HOME are set
This commit is contained in:
		
							parent
							
								
									54c3b63d24
								
							
						
					
					
						commit
						e093f57c10
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
					@ -247,12 +247,14 @@ int main(int argc, char **argv)
 | 
				
			||||||
	if (getenv("XDG_STATE_HOME") == NULL || getenv("XDG_STATE_HOME")[0] == '\0') {
 | 
						if (getenv("XDG_STATE_HOME") == NULL || getenv("XDG_STATE_HOME")[0] == '\0') {
 | 
				
			||||||
		if (getenv("HOME") != NULL) {
 | 
							if (getenv("HOME") != NULL) {
 | 
				
			||||||
			yosys_history_file = stringf("%s/.local/state/.yosys_history", getenv("HOME"));
 | 
								yosys_history_file = stringf("%s/.local/state/.yosys_history", getenv("HOME"));
 | 
				
			||||||
 | 
								read_history(yosys_history_file.c_str());
 | 
				
			||||||
 | 
								yosys_history_offset = where_history();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		yosys_history_file = stringf("%s/.yosys_history", getenv("XDG_STATE_HOME"));
 | 
							yosys_history_file = stringf("%s/.yosys_history", getenv("XDG_STATE_HOME"));
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
		read_history(yosys_history_file.c_str());
 | 
							read_history(yosys_history_file.c_str());
 | 
				
			||||||
		yosys_history_offset = where_history();
 | 
							yosys_history_offset = where_history();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (argc == 2 && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "-help") || !strcmp(argv[1], "--help")))
 | 
						if (argc == 2 && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "-help") || !strcmp(argv[1], "--help")))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue