mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-06 06:03:23 +00:00
chore: use similar variable/function names
This commit is contained in:
parent
dd5dc06863
commit
c1d3288654
2 changed files with 14 additions and 14 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue