------------------------------------------------------------------------------------------------ Convert a relative path into an absolute path
| 166 | // ------------------------------------------------------------------------------------------------ |
| 167 | // Convert a relative path into an absolute path |
| 168 | inline static std::string MakeAbsolutePath(const char *in) { |
| 169 | ai_assert(in); |
| 170 | std::string out; |
| 171 | #ifdef _WIN32 |
| 172 | wchar_t *ret = ::_wfullpath(nullptr, Utf8ToWide(in).c_str(), 0); |
| 173 | if (ret) { |
| 174 | out = WideToUtf8(ret); |
| 175 | free(ret); |
| 176 | } |
| 177 | #else |
| 178 | char *ret = realpath(in, nullptr); |
| 179 | if (ret) { |
| 180 | out = ret; |
| 181 | free(ret); |
| 182 | } |
| 183 | #endif |
| 184 | else { |
| 185 | // preserve the input path, maybe someone else is able to fix |
| 186 | // the path before it is accessed (e.g. our file system filter) |
| 187 | ASSIMP_LOG_WARN("Invalid path: ", std::string(in)); |
| 188 | out = in; |
| 189 | } |
| 190 | return out; |
| 191 | } |
| 192 |
no test coverage detected