| 133 | } |
| 134 | |
| 135 | std::string getUnixPath(const std::string &path) { |
| 136 | #if defined(_WIN32) |
| 137 | using GetUnixFileName = LPSTR (*CDECL)(LPCWSTR); |
| 138 | |
| 139 | static auto wine_get_unix_file_name = |
| 140 | reinterpret_cast<GetUnixFileName>(::GetProcAddress( |
| 141 | ::GetModuleHandleW(L"kernel32.dll"), "wine_get_unix_file_name")); |
| 142 | |
| 143 | if (wine_get_unix_file_name) { |
| 144 | std::array<WCHAR, MAX_PATH + 1> widePath; |
| 145 | |
| 146 | size_t length = str::transcodeString(widePath.data(), widePath.size() - 1, |
| 147 | path.data(), path.size()); |
| 148 | |
| 149 | widePath[length] = L'\0'; |
| 150 | return std::string(wine_get_unix_file_name(widePath.data())); |
| 151 | } |
| 152 | return ""; |
| 153 | #else |
| 154 | return path; |
| 155 | #endif |
| 156 | } |
| 157 | |
| 158 | } // namespace dxmt::env |
no test coverage detected