diff --git a/CMakeLists.txt b/CMakeLists.txt index 48b3b18a48..647b99e578 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,7 +65,9 @@ add_definitions(-DREACTOS_BINARY_DIR="${REACTOS_BINARY_DIR}") # There doesn't seem to be a standard for __FILE__ being relative or absolute, so detect it at runtime. file(RELATIVE_PATH _PATH_PREFIX ${REACTOS_BINARY_DIR} ${REACTOS_SOURCE_DIR}) -add_compile_flags(-D__RELFILE__="&__FILE__[__FILE__[0] == '.' ? sizeof \\\"${_PATH_PREFIX}\\\" - 1 : sizeof REACTOS_SOURCE_DIR]") +add_definitions(-DREACTOS_PATH_PREFIX="\\\"${_PATH_PREFIX}\\\"") +add_definitions(-DREACTOS_FILE_PATH="\\\"${__FILE__}\\\"") +#add_compile_flags(-D__RELFILE__="&__FILE__[__FILE__[0] == '.' ? sizeof \\\"${_PATH_PREFIX}\\\" - 1 : sizeof REACTOS_SOURCE_DIR]") if(MSVC_IDE) add_compile_flags("/MP") diff --git a/sdk/include/reactos/debug.h b/sdk/include/reactos/debug.h index ab332fda18..34a5f9131e 100644 --- a/sdk/include/reactos/debug.h +++ b/sdk/include/reactos/debug.h @@ -15,7 +15,16 @@ #pragma once #ifndef __RELFILE__ -#define __RELFILE__ __FILE__ +static __inline const char *reactos_relative_path(void) +{ + const char *path = REACTOS_FILE_PATH; + if (path[0] == '.') + { + return &path[sizeof(REACTOS_PATH_PREFIX) - 1]; + } + return &path[sizeof(REACTOS_SOURCE_DIR)]; +} +#define __RELFILE__ reactos_relative_path() #endif /* Define DbgPrint/DbgPrintEx/RtlAssert unless the NDK is used */ diff --git a/sdk/include/reactos/wine/debug.h b/sdk/include/reactos/wine/debug.h index 35aefc9852..641995647b 100644 --- a/sdk/include/reactos/wine/debug.h +++ b/sdk/include/reactos/wine/debug.h @@ -28,7 +28,16 @@ #endif #ifndef __RELFILE__ -#define __RELFILE__ __FILE__ +static __inline const char *reactos_relative_path(void) +{ + const char *path = REACTOS_FILE_PATH; + if (path[0] == '.') + { + return &path[sizeof(REACTOS_PATH_PREFIX) - 1]; + } + return &path[sizeof(REACTOS_SOURCE_DIR)]; +} +#define __RELFILE__ reactos_relative_path() #endif #ifdef __WINE_WINE_TEST_H