We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4c72b0e commit 7d4d544Copy full SHA for 7d4d544
kernel/io.cc
@@ -251,7 +251,15 @@ bool check_is_directory(const std::string& dirname)
251
{
252
#if defined(_WIN32)
253
struct _stat info;
254
- if (_stat(dirname.c_str(), &info) != 0)
+ auto dirname_ = dirname;
255
+
256
+ /* On old versions of Visual Studio and current versions on MinGW,
257
+ _stat will fail if the path ends with a trailing slash. */
258
+ if (dirname.back() == '/' || dirname.back() == '\\') {
259
+ dirname_ = dirname.substr(0, dirname.length() - 1);
260
+ }
261
262
+ if (_stat(dirname_.c_str(), &info) != 0)
263
264
return false;
265
}
0 commit comments