mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-07 06:33:24 +00:00
Strip trailing slashes when checking for directories on Windows.
This commit is contained in:
parent
4c72b0ecd8
commit
7d4d544001
1 changed files with 9 additions and 1 deletions
10
kernel/io.cc
10
kernel/io.cc
|
@ -251,7 +251,15 @@ bool check_is_directory(const std::string& dirname)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
struct _stat info;
|
struct _stat info;
|
||||||
if (_stat(dirname.c_str(), &info) != 0)
|
auto dirname_ = dirname;
|
||||||
|
|
||||||
|
/* On old versions of Visual Studio and current versions on MinGW,
|
||||||
|
_stat will fail if the path ends with a trailing slash. */
|
||||||
|
if (dirname.back() == '/' || dirname.back() == '\\') {
|
||||||
|
dirname_ = dirname.substr(0, dirname.length() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_stat(dirname_.c_str(), &info) != 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue