Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand scope of NRN_AVOID_ABSOLUTE_PATHS #3310

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
11 changes: 9 additions & 2 deletions src/nocmodl/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,15 @@ void unGets(char* buf) /* all this because we don't have an ENDBLOCK
char* current_line() { /* assumes we actually want the previous line */
static char buf[NRN_BUFSIZE];
char* p;
Sprintf(
buf, "at line %d in file %s:\\n%s", linenum - 1, finname, inlinebuf[whichbuf ? 0 : 1] + 30);
Sprintf(buf,
"at line %d in file %s:\\n%s",
linenum - 1,
#if !defined(NRN_AVOID_ABSOLUTE_PATHS)
finname,
#else
fs::absolute(finname).filename().c_str(),
#endif
inlinebuf[whichbuf ? 0 : 1] + 30);
for (p = buf; *p; ++p) {
if (*p == '\n') {
*p = '\0';
Expand Down
4 changes: 3 additions & 1 deletion src/nocmodl/modl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ int main(int argc, char** argv) {
#if !defined(NRN_AVOID_ABSOLUTE_PATHS)
fprintf(fcout, " const char* nmodl_filename = \"%s\";\n", fs::absolute(finname).c_str());
#else
fprintf(fcout, " const char* nmodl_filename = \"%s\";\n", finname);
fprintf(fcout,
" const char* nmodl_filename = \"%s\";\n",
fs::path(finname).filename().c_str());
#endif
fprintf(fcout, " const char* nmodl_file_text = \n");
ITERATE(q, filetxtlist) {
Expand Down
5 changes: 4 additions & 1 deletion src/nocmodl/nocpout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,10 @@ if (auto* const _extnode = _nrn_mechanism_access_extnode(_nd); _extnode) {\n\
mechname,
fs::absolute(finname).c_str());
#else
Sprintf(buf1, "\tivoc_help(\"help ?1 %s %s\\n\");\n", mechname, finname);
Sprintf(buf1,
"\tivoc_help(\"help ?1 %s %s\\n\");\n",
mechname,
fs::path(finname).filename().c_str());
#endif
Lappendstr(defs_list, buf1);
}
Expand Down
Loading