| 428 | } |
| 429 | |
| 430 | static StringSpan getExecutablePath(StringPath& executablePath) |
| 431 | { |
| 432 | #if SC_PLATFORM_WINDOWS |
| 433 | if (not TestingWindowsDetail::WindowsPath::getExecutablePath(executablePath)) |
| 434 | { |
| 435 | (void)executablePath.resize(0); |
| 436 | return {}; |
| 437 | } |
| 438 | return executablePath.view(); |
| 439 | #elif SC_PLATFORM_APPLE |
| 440 | uint32_t size = static_cast<uint32_t>(StringPath::MaxPath); |
| 441 | if (_NSGetExecutablePath(executablePath.writableSpan().data(), &size) == 0) |
| 442 | { |
| 443 | const size_t length = ::strlen(executablePath.writableSpan().data()); |
| 444 | (void)executablePath.resize(length); |
| 445 | return executablePath.view(); |
| 446 | } |
| 447 | return {}; |
| 448 | #else |
| 449 | const int pathLength = ::readlink("/proc/self/exe", executablePath.writableSpan().data(), StringPath::MaxPath); |
| 450 | if (pathLength > 0) |
| 451 | { |
| 452 | (void)executablePath.resize(static_cast<size_t>(pathLength)); |
| 453 | return executablePath.view(); |
| 454 | } |
| 455 | return {}; |
| 456 | #endif |
| 457 | } |
| 458 | |
| 459 | static StringSpan getCurrentWorkingDirectory(StringPath& currentWorkingDirectory) |
| 460 | { |
no test coverage detected