diff --git a/Sources/_TestingInternals/ExecutablePath.cpp b/Sources/_TestingInternals/ExecutablePath.cpp index 7213cfa75..82297b452 100644 --- a/Sources/_TestingInternals/ExecutablePath.cpp +++ b/Sources/_TestingInternals/ExecutablePath.cpp @@ -29,8 +29,12 @@ static void captureEarlyCWD(void) { earlyCWD.store(buffer); } } +#endif const char *swt_getEarlyCWD(void) { +#if defined(__OpenBSD__) return earlyCWD.load(); -} +#else + return nullptr; #endif +} diff --git a/Sources/_TestingInternals/include/ExecutablePath.h b/Sources/_TestingInternals/include/ExecutablePath.h index 22f3acc62..dfa9b1e7e 100644 --- a/Sources/_TestingInternals/include/ExecutablePath.h +++ b/Sources/_TestingInternals/include/ExecutablePath.h @@ -16,15 +16,15 @@ SWT_ASSUME_NONNULL_BEGIN -#if defined(__OpenBSD__) /// Get the current working directory as it was set shortly after the process /// started and before `main()` has been called. /// /// This function is necessary on OpenBSD so that we can (as correctly as /// possible) resolve the executable path when the first argument is a relative /// path (which can occur when manually invoking the test executable.) +/// +/// On all other platforms, this function always returns `nullptr`. SWT_EXTERN const char *_Nullable swt_getEarlyCWD(void); -#endif SWT_ASSUME_NONNULL_END