MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / setPath

Function setPath

src/common/db_alias.cpp:461–484  ·  view source on GitHub ↗

Set a prefix to a filename based on the ISC_PATH user variable. Returns true if database name is expanded using ISC_PATH.

Source from the content-addressed store, hash-verified

459// Set a prefix to a filename based on the ISC_PATH user variable.
460// Returns true if database name is expanded using ISC_PATH.
461static bool setPath(const PathName& filename, PathName& expandedName)
462{
463 // Look for the environment variables to tack onto the beginning of the database path.
464 PathName pathname;
465 if (!fb_utils::readenv("ISC_PATH", pathname))
466 return false;
467
468 // If the file already contains a remote node or any path at all forget it.
469 if (hasSeparator(filename))
470 return false;
471
472 // concatenate the strings
473
474 expandedName = pathname;
475
476 // CVC: Make the concatenation work if no slash is present.
477 char lastChar = expandedName[expandedName.length() - 1];
478 if (lastChar != ':' && lastChar != '/' && lastChar != '\\')
479 expandedName.append(1, PathUtils::dir_sep);
480
481 expandedName.append(filename);
482
483 return true;
484}
485
486// Full processing of database name
487// Returns true if alias was found in databases.conf

Callers 1

expandDatabaseNameFunction · 0.85

Calls 4

readenvFunction · 0.85
hasSeparatorFunction · 0.85
lengthMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected