| 289 | } |
| 290 | |
| 291 | static bool resolveCompiledLibraryRoot(StringSpan executablePath, StringPath& libraryRoot, StartupAttempt* attempts, |
| 292 | size_t maxAttempts, size_t& numAttempts) |
| 293 | { |
| 294 | #if defined(SC_LIBRARY_ROOT) |
| 295 | const StringSpan compiledLibraryRoot = |
| 296 | StringSpan::fromNullTerminated(SC_COMPILER_LIBRARY_PATH, StringEncoding::Utf8); |
| 297 | if (compiledLibraryRoot.isEmpty()) |
| 298 | return false; |
| 299 | |
| 300 | StringPath compiledLibraryRootPath; |
| 301 | if (!compiledLibraryRootPath.assign(compiledLibraryRoot)) |
| 302 | return false; |
| 303 | |
| 304 | StringPath candidate; |
| 305 | if (isAbsoluteNative(compiledLibraryRootPath.view())) |
| 306 | { |
| 307 | if (!candidate.assign(compiledLibraryRootPath.view())) |
| 308 | return false; |
| 309 | } |
| 310 | else |
| 311 | { |
| 312 | StringPath executableDirectory; |
| 313 | if (!getDirectoryName(executablePath, executableDirectory)) |
| 314 | return false; |
| 315 | if (!pathJoin(candidate, executableDirectory.view(), compiledLibraryRootPath.view())) |
| 316 | return false; |
| 317 | } |
| 318 | |
| 319 | StringPath normalizedCandidate; |
| 320 | if (normalizeNativePath(candidate.view(), normalizedCandidate)) |
| 321 | { |
| 322 | candidate = move(normalizedCandidate); |
| 323 | } |
| 324 | |
| 325 | recordAttempt(attempts, maxAttempts, numAttempts, "compiled relative root", candidate.view()); |
| 326 | if (validateLibraryRoot(candidate.view())) |
| 327 | { |
| 328 | return libraryRoot.assign(candidate.view()) ? true : false; |
| 329 | } |
| 330 | return false; |
| 331 | #else |
| 332 | (void)(executablePath); |
| 333 | (void)(libraryRoot); |
| 334 | (void)(attempts); |
| 335 | (void)(maxAttempts); |
| 336 | (void)(numAttempts); |
| 337 | return false; |
| 338 | #endif |
| 339 | } |
| 340 | |
| 341 | static void reportLibraryRootFailure(TestReport::IOutput& console, StringSpan applicationRoot, StartupAttempt* attempts, |
| 342 | size_t numAttempts, StringSpan explicitOverride, bool explicitOverrideProvided, |
no test coverage detected