From c1d32886540bd22bd78646b0694a67c49f1550a5 Mon Sep 17 00:00:00 2001 From: hakan-demirli Date: Fri, 2 Feb 2024 01:25:58 +0300 Subject: [PATCH] chore: use similar variable/function names --- kernel/yosys.cc | 24 ++++++++++++------------ kernel/yosys.h | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/kernel/yosys.cc b/kernel/yosys.cc index 0362bc1eb87..c7f5bebdab7 100644 --- a/kernel/yosys.cc +++ b/kernel/yosys.cc @@ -436,18 +436,18 @@ std::string make_temp_dir(std::string template_str) #endif } -bool check_dir_exists(const std::string& path) +bool check_directory_exists(const std::string& dirname) { #if defined(_WIN32) struct _stat info; - if (_stat(path.c_str(), &info) != 0) + if (_stat(dirname.c_str(), &info) != 0) { return false; } return (info.st_mode & _S_IFDIR) != 0; #else struct stat info; - if (stat(path.c_str(), &info) != 0) + if (stat(dirname.c_str(), &info) != 0) { return false; } @@ -500,13 +500,13 @@ void remove_directory(std::string dirname) #endif } -bool create_directory(const std::string& path) +bool create_directory(const std::string& dirname) { #if defined(_WIN32) - int ret = _mkdir(path.c_str()); + int ret = _mkdir(dirname.c_str()); #else mode_t mode = 0755; - int ret = mkdir(path.c_str(), mode); + int ret = mkdir(dirname.c_str(), mode); #endif if (ret == 0) return true; @@ -516,26 +516,26 @@ bool create_directory(const std::string& path) case ENOENT: // parent didn't exist, try to create it { - std::string::size_type pos = path.find_last_of('/'); + std::string::size_type pos = dirname.find_last_of('/'); if (pos == std::string::npos) #if defined(_WIN32) - pos = path.find_last_of('\\'); + pos = dirname.find_last_of('\\'); if (pos == std::string::npos) #endif return false; - if (!create_directory( path.substr(0, pos) )) + if (!create_directory( dirname.substr(0, pos) )) return false; } // now, try to create again #if defined(_WIN32) - return 0 == _mkdir(path.c_str()); + return 0 == _mkdir(dirname.c_str()); #else - return 0 == mkdir(path.c_str(), mode); + return 0 == mkdir(dirname.c_str(), mode); #endif case EEXIST: // done! - return check_dir_exists(path); + return check_directory_exists(dirname); default: return false; diff --git a/kernel/yosys.h b/kernel/yosys.h index 76ad01aa985..0a4641d1819 100644 --- a/kernel/yosys.h +++ b/kernel/yosys.h @@ -343,10 +343,10 @@ std::string get_base_tmpdir(); std::string make_temp_file(std::string template_str = get_base_tmpdir() + "/yosys_XXXXXX"); std::string make_temp_dir(std::string template_str = get_base_tmpdir() + "/yosys_XXXXXX"); bool check_file_exists(std::string filename, bool is_exec = false); -bool check_dir_exists(const std::string& path); +bool check_directory_exists(const std::string& dirname); bool is_absolute_path(std::string filename); void remove_directory(std::string dirname); -bool create_directory(const std::string& path); +bool create_directory(const std::string& dirname); std::string escape_filename_spaces(const std::string& filename); template int GetSize(const T &obj) { return obj.size(); }