| // Copyright 2021 PDFium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| #include "core/fxcrt/fx_folder.h" |
| #include "build/build_config.h" |
| #error "built on wrong platform" |
| WIN32_FIND_DATAA m_FindData; |
| FX_FolderHandle* FX_OpenFolder(const char* path) { |
| auto handle = std::make_unique<FX_FolderHandle>(); |
| FindFirstFileExA((ByteString(path) + "/*.*").c_str(), FindExInfoStandard, |
| &handle->m_FindData, FindExSearchNameMatch, nullptr, 0); |
| if (handle->m_Handle == INVALID_HANDLE_VALUE) |
| handle->m_bReachedEnd = false; |
| bool FX_GetNextFile(FX_FolderHandle* handle, |
| if (handle->m_bReachedEnd) |
| *filename = handle->m_FindData.cFileName; |
| (handle->m_FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0; |
| if (!FindNextFileA(handle->m_Handle, &handle->m_FindData)) |
| handle->m_bReachedEnd = true; |
| void FX_CloseFolder(FX_FolderHandle* handle) { |
| FindClose(handle->m_Handle); |