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

Function getPrefix

src/common/utils.cpp:1215–1348  ·  view source on GitHub ↗

Build full file name in specified directory

Source from the content-addressed store, hash-verified

1213
1214// Build full file name in specified directory
1215Firebird::PathName getPrefix(unsigned int prefType, const char* name)
1216{
1217 Firebird::PathName s;
1218
1219#ifdef ANDROID
1220 const bool useInstallDir =
1221 prefType == Firebird::IConfigManager::DIR_BIN ||
1222 prefType == Firebird::IConfigManager::DIR_SBIN ||
1223 prefType == Firebird::IConfigManager::DIR_LIB ||
1224 prefType == Firebird::IConfigManager::DIR_GUARD ||
1225 prefType == Firebird::IConfigManager::DIR_PLUGINS;
1226
1227 if (useInstallDir)
1228 s = name;
1229 else
1230 PathUtils::concatPath(s, Firebird::Config::getRootDirectory(), name);
1231
1232 return s;
1233#else
1234 char tmp[MAXPATHLEN];
1235
1236 const char* configDir[] = {
1237 FB_BINDIR, FB_SBINDIR, FB_CONFDIR, FB_LIBDIR, FB_INCDIR, FB_DOCDIR, "", FB_SAMPLEDIR,
1238 FB_SAMPLEDBDIR, "", FB_INTLDIR, FB_MISCDIR, FB_SECDBDIR, FB_MSGDIR, FB_LOGDIR,
1239 FB_GUARDDIR, FB_PLUGDIR, FB_TZDATADIR
1240 };
1241
1242 fb_assert(FB_NELEM(configDir) == Firebird::IConfigManager::DIR_COUNT);
1243 fb_assert(prefType < Firebird::IConfigManager::DIR_COUNT);
1244
1245 if (! bootBuild())
1246 {
1247 if (prefType != Firebird::IConfigManager::DIR_CONF &&
1248 prefType != Firebird::IConfigManager::DIR_MSG &&
1249 prefType != Firebird::IConfigManager::DIR_TZDATA &&
1250 configDir[prefType][0])
1251 {
1252 // Value is set explicitly and is not environment overridable
1253 PathUtils::concatPath(s, configDir[prefType], name);
1254
1255 if (PathUtils::isRelative(s))
1256 {
1257 gds__prefix(tmp, s.c_str());
1258 return tmp;
1259 }
1260
1261 return s;
1262 }
1263 }
1264
1265 switch (prefType)
1266 {
1267 case Firebird::IConfigManager::DIR_BIN:
1268 case Firebird::IConfigManager::DIR_SBIN:
1269#ifdef WIN_NT
1270 s = "";
1271#else
1272 s = "bin";

Callers 15

WinMainFunction · 0.85
UTIL_start_processFunction · 0.85
UTIL_ex_lockFunction · 0.85
start_serverFunction · 0.85
gen_database_dataFunction · 0.85
JRD_print_procedure_infoFunction · 0.85
initializeMethod · 0.85
readFbLogMethod · 0.85
parseExternalValueFunction · 0.85
getMethod · 0.85
enumerateMethod · 0.85
LogWriterMethod · 0.85

Calls 3

bootBuildFunction · 0.85
c_strMethod · 0.45
hasDataMethod · 0.45

Tested by

no test coverage detected