MCPcopy Create free account
hub / github.com/csyonghe/Spire / osFindFilesInDirectoryMatchingPattern

Function osFindFilesInDirectoryMatchingPattern

Tests/SpireTestTool/os.cpp:29–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27}
28
29OSFindFilesResult osFindFilesInDirectoryMatchingPattern(
30 CoreLib::Basic::String directoryPath,
31 CoreLib::Basic::String pattern)
32{
33 // TODO: add separator to end of directory path if needed
34
35 String searchPath = directoryPath + pattern;
36
37 OSFindFilesResult result;
38 HANDLE findHandle = FindFirstFileW(
39 searchPath.ToWString(),
40 &result.fileData_);
41
42 result.directoryPath_ = directoryPath;
43 result.findHandle_ = findHandle;
44
45 if (findHandle == INVALID_HANDLE_VALUE)
46 {
47 result.error_ = kOSError_FileNotFound;
48 }
49 else
50 {
51 result.filePath_ = directoryPath + String::FromWString(result.fileData_.cFileName);
52 result.error_ = kOSError_None;
53 }
54
55 return result;
56}
57
58// OSProcessSpawner
59

Callers 1

runTestsInDirectoryFunction · 0.85

Calls 1

ToWStringMethod · 0.80

Tested by

no test coverage detected