Skip to content

Commit

Permalink
Fix run when in build dir (navit-gps#957)
Browse files Browse the repository at this point in the history
* add:build:core:Add file which is only visible to devs to detect when navit is running in build dir
  • Loading branch information
jkoan committed Jun 30, 2021
1 parent cf4e4c4 commit 8c06722
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions navit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ include_directories( "${PROJECT_SOURCE_DIR}")
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}")
include_directories( "${CMAKE_CURRENT_BINARY_DIR}")
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/support")
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/THIS_IS_THE_NAVIT_WORKING_DIR "\r\nThis File should never appear on binary distributions\r\n" )
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/THIS_IS_THE_NAVIT_WORKING_DIR "\r\nOnly Devs should ever see this file" )

# navit core
set(NAVIT_SRC announcement.c atom.c attr.c cache.c callback.c command.c config_.c coord.c country.c data_window.c debug.c
Expand Down
3 changes: 2 additions & 1 deletion navit/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,8 @@ void main_init(const char *program) {
setlocale(LC_NUMERIC,"C");
#endif
#if !defined _WIN32 && !defined _WIN32_WCE
if (file_exists("navit.c") || file_exists("navit.o") || file_exists("navit.lo") || file_exists("version.h")) {
if (file_exists("navit.c") || file_exists("navit.o") || file_exists("navit.lo")
|| file_exists("THIS_IS_THE_NAVIT_WORKING_DIR")) {
char buffer[PATH_MAX];
printf("%s",_("Running from source directory\n"));
if(getcwd(buffer, PATH_MAX)==NULL) { /*libc of navit returns "dummy" */
Expand Down

0 comments on commit 8c06722

Please sign in to comment.