Browse Source

Fix water::DirectoryIterator for windows builds

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.5.0
falkTX 2 years ago
parent
commit
a80680f5a1
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 5 additions and 13 deletions
  1. +5
    -13
      source/modules/water/files/File.cpp

+ 5
- 13
source/modules/water/files/File.cpp View File

@@ -1129,8 +1129,8 @@ File File::getSpecialLocation (const SpecialLocationType type)
case tempDirectory:
{
WCHAR wdest [2048];
CHAR adest [2048];
WCHAR wdest [MAX_PATH + 256];
CHAR adest [MAX_PATH + 256];
wdest[0] = 0;
GetTempPathW ((DWORD) numElementsInArray (wdest), wdest);
@@ -1190,18 +1190,10 @@ public:
return false;
}
const size_t wlen = wcslen(findData.cFileName);
CARLA_SAFE_ASSERT_RETURN (wlen > 0, false);
CHAR apath [MAX_PATH + 256];
const int len = WideCharToMultiByte (CP_UTF8, 0, findData.cFileName, (int) wlen, nullptr, 0, nullptr, nullptr);
CARLA_SAFE_ASSERT_RETURN (len > 0, false);
if (CHAR* const path = new CHAR [len])
{
WideCharToMultiByte (CP_UTF8, 0, findData.cFileName, (int) wlen, path, len, nullptr, nullptr);
filenameFound = path;
delete[] path;
}
if (WideCharToMultiByte (CP_UTF8, 0, findData.cFileName, -1, apath, numElementsInArray (apath), nullptr, nullptr))
filenameFound = apath;
if (isDir != nullptr) *isDir = ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0);
if (isReadOnly != nullptr) *isReadOnly = ((findData.dwFileAttributes & FILE_ATTRIBUTE_READONLY) != 0);


Loading…
Cancel
Save