MCPcopy Create free account
hub / github.com/OpenCppCoverage/OpenCppCoverage / ComputeFilename

Method ComputeFilename

CppCoverage/HandleInformation.cpp:126–153  ·  view source on GitHub ↗

-------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

124
125 //-------------------------------------------------------------------------
126 std::wstring HandleInformation::ComputeFilename(HANDLE hfile) const
127 {
128 if (hfile == nullptr)
129 {
130 THROW(L"OpenCppCoverage cannot find the name of the module.\n"
131 L"See "
132 L"https://github.com/OpenCppCoverage/OpenCppCoverage/wiki/"
133 L"FAQ#error-opencppcoverage-cannot-find-the-name-of-the-"
134 L"module for more information.");
135 }
136
137 auto mappedFileName = GetFinalPathName(hfile);
138 auto queryDosDevicesMapping = GetQueryDosDevicesMapping();
139
140 for (const auto& queryDosDeviceMapping : queryDosDevicesMapping)
141 {
142 const auto& deviceName = queryDosDeviceMapping.first;
143 const auto& logicalDrive = queryDosDeviceMapping.second;
144
145 if (boost::algorithm::istarts_with(mappedFileName, deviceName))
146 {
147 boost::algorithm::ireplace_first(mappedFileName, deviceName, logicalDrive);
148 return mappedFileName;
149 }
150 }
151
152 THROW(L"Cannot find path for the handle: " << mappedFileName);
153 }
154}

Callers 2

LoadModuleMethod · 0.80
TESTFunction · 0.80

Calls 2

GetFinalPathNameFunction · 0.85

Tested by 1

TESTFunction · 0.64