MCPcopy Create free account
hub / github.com/3Shain/dxmt / getUnixPath

Function getUnixPath

src/util/util_env.cpp:135–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135std::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

Callers 1

CommitChunkInternalMethod · 0.85

Calls 3

transcodeStringFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected