mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Fix FileUtils::isDirectory not handling errors correctly on Win32
This commit is contained in:
parent
d0a3173776
commit
41336505c6
1 changed files with 8 additions and 2 deletions
|
@ -190,7 +190,10 @@ bool traverseDirectory(const std::string& path, const std::function<void(const s
|
|||
bool isDirectory(const std::string& path)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return (GetFileAttributesW(fromUtf8(path).c_str()) & FILE_ATTRIBUTE_DIRECTORY) != 0;
|
||||
DWORD fileAttributes = GetFileAttributesW(fromUtf8(path).c_str());
|
||||
if (fileAttributes == INVALID_FILE_ATTRIBUTES)
|
||||
return false;
|
||||
return (fileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
|
||||
#else
|
||||
struct stat st = {};
|
||||
lstat(path.c_str(), &st);
|
||||
|
@ -244,8 +247,11 @@ std::vector<std::string> getSourceFiles(int argc, char** argv)
|
|||
|
||||
for (int i = 1; i < argc; ++i)
|
||||
{
|
||||
if (argv[i][0] == '-')
|
||||
// Treat '-' as a special file whose source is read from stdin
|
||||
// All other arguments that start with '-' are skipped
|
||||
if (argv[i][0] == '-' && argv[i][1] != '\0') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isDirectory(argv[i]))
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue