-------------------------------------------------------------------------
| 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 | } |