mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 13:29:12 +00:00 
			
		
		
		
	Fixed detection of absolute paths in ABC for win32
This commit is contained in:
		
							parent
							
								
									611cd010ae
								
							
						
					
					
						commit
						68bbb15214
					
				
					 3 changed files with 13 additions and 3 deletions
				
			
		| 
						 | 
					@ -376,6 +376,15 @@ bool check_file_exists(std::string filename, bool is_exec)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool is_absolute_path(std::string filename)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					#ifdef _WIN32
 | 
				
			||||||
 | 
						return filename[0] == '/' || filename[0] == '\\' || (filename[0] != 0 && filename[1] == ':');
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
						return filename[0] == '/';
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void remove_directory(std::string dirname)
 | 
					void remove_directory(std::string dirname)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
#ifdef _WIN32
 | 
					#ifdef _WIN32
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -210,6 +210,7 @@ int run_command(const std::string &command, std::function<void(const std::string
 | 
				
			||||||
std::string make_temp_file(std::string template_str = "/tmp/yosys_XXXXXX");
 | 
					std::string make_temp_file(std::string template_str = "/tmp/yosys_XXXXXX");
 | 
				
			||||||
std::string make_temp_dir(std::string template_str = "/tmp/yosys_XXXXXX");
 | 
					std::string make_temp_dir(std::string template_str = "/tmp/yosys_XXXXXX");
 | 
				
			||||||
bool check_file_exists(std::string filename, bool is_exec = false);
 | 
					bool check_file_exists(std::string filename, bool is_exec = false);
 | 
				
			||||||
 | 
					bool is_absolute_path(std::string filename);
 | 
				
			||||||
void remove_directory(std::string dirname);
 | 
					void remove_directory(std::string dirname);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template<typename T> int GetSize(const T &obj) { return obj.size(); }
 | 
					template<typename T> int GetSize(const T &obj) { return obj.size(); }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1216,19 +1216,19 @@ struct AbcPass : public Pass {
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (arg == "-script" && argidx+1 < args.size()) {
 | 
								if (arg == "-script" && argidx+1 < args.size()) {
 | 
				
			||||||
				script_file = args[++argidx];
 | 
									script_file = args[++argidx];
 | 
				
			||||||
				if (!script_file.empty() && script_file[0] != '/' && script_file[0] != '+')
 | 
									if (!script_file.empty() && !is_absolute_path(script_file) && script_file[0] != '+')
 | 
				
			||||||
					script_file = std::string(pwd) + "/" + script_file;
 | 
										script_file = std::string(pwd) + "/" + script_file;
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (arg == "-liberty" && argidx+1 < args.size()) {
 | 
								if (arg == "-liberty" && argidx+1 < args.size()) {
 | 
				
			||||||
				liberty_file = args[++argidx];
 | 
									liberty_file = args[++argidx];
 | 
				
			||||||
				if (!liberty_file.empty() && liberty_file[0] != '/')
 | 
									if (!liberty_file.empty() && !is_absolute_path(liberty_file))
 | 
				
			||||||
					liberty_file = std::string(pwd) + "/" + liberty_file;
 | 
										liberty_file = std::string(pwd) + "/" + liberty_file;
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (arg == "-constr" && argidx+1 < args.size()) {
 | 
								if (arg == "-constr" && argidx+1 < args.size()) {
 | 
				
			||||||
				constr_file = args[++argidx];
 | 
									constr_file = args[++argidx];
 | 
				
			||||||
				if (!constr_file.empty() && constr_file[0] != '/')
 | 
									if (!constr_file.empty() && !is_absolute_path(constr_file))
 | 
				
			||||||
					constr_file = std::string(pwd) + "/" + constr_file;
 | 
										constr_file = std::string(pwd) + "/" + constr_file;
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue