| 534 | #endif |
| 535 | |
| 536 | mi_decl_nodiscard static mi_decl_restrict char* mi_theap_realpath(mi_theap_t* theap, const char* fname, char* resolved_name) mi_attr_noexcept { |
| 537 | // todo: use GetFullPathNameW to allow longer file names |
| 538 | char buf[PATH_MAX]; |
| 539 | DWORD res = GetFullPathNameA(fname, PATH_MAX, (resolved_name == NULL ? buf : resolved_name), NULL); |
| 540 | if (res == 0) { |
| 541 | errno = GetLastError(); return NULL; |
| 542 | } |
| 543 | else if (res > PATH_MAX) { |
| 544 | errno = EINVAL; return NULL; |
| 545 | } |
| 546 | else if (resolved_name != NULL) { |
| 547 | return resolved_name; |
| 548 | } |
| 549 | else { |
| 550 | return mi_theap_strndup(theap, buf, PATH_MAX); |
| 551 | } |
| 552 | } |
| 553 | |
| 554 | #else |
| 555 |
no test coverage detected