Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Sources/_TestingInternals/ExecutablePath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
4 changes: 2 additions & 2 deletions Sources/_TestingInternals/include/ExecutablePath.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down