Set a prefix to a filename based on the ISC_PATH user variable. Returns true if database name is expanded using ISC_PATH.
| 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. |
| 461 | static 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 |
no test coverage detected