Skip to content

Commit

Permalink
FIXED: Handling of home during boot session.
Browse files Browse the repository at this point in the history
  • Loading branch information
JanWielemaker committed Dec 8, 2024
1 parent f5b4a21 commit a410eb6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ configure_file(version.h.in version.h)
add_custom_command(
OUTPUT ${SWIPL_BOOT_FILE}
COMMAND ${CMAKE_COMMAND} -E remove -f ${SWIPL_BOOT_FILE}
COMMAND ${PROG_SWIPL_FOR_BOOT} -q -O -o ${SWIPL_BOOT_FILE}
COMMAND ${PROG_SWIPL_FOR_BOOT} --home=${SWIPL_BUILD_HOME} -q -O -o ${SWIPL_BOOT_FILE}
-b ${SWIPL_BUILD_HOME}/boot/init.pl
DEPENDS ${DEP_SWIPL_FOR_BOOT} ${SWIPL_BOOT_FILES}
)
Expand Down
14 changes: 13 additions & 1 deletion src/pl-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,18 @@ searchHome(const char *symbols, bool verbose)
}
}

static bool
is_boot_session(int argc, const char **argv)
{ for(int i=0; i<argc && argv[i]; i++)
{ if ( strcmp(argv[i], "-b") == 0 )
return true;
if ( strcmp(argv[i], "--") == 0 )
break;
}

return false;
}

static char *
findHome(const char *symbols, int argc, const char **argv)
{ char *home = NULL;
Expand All @@ -529,7 +541,7 @@ findHome(const char *symbols, int argc, const char **argv)
(home=AbsoluteFile(home, plp, sizeof(plp))) )
{ home = store_string(home);
int rc = check_home(home);
if ( rc < 0 )
if ( rc < 0 && !is_boot_session(argc, argv) )
warn_bad_home("WARNING: Invalid SWI-Prolog home directory ", home, rc);
return home;
} else
Expand Down

0 comments on commit a410eb6

Please sign in to comment.