mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 22:43:03 +01:00
Added macros for main firebird directories to config files
This commit is contained in:
parent
f538f69cc0
commit
313e2765c9
@ -5,11 +5,8 @@
|
||||
#
|
||||
# Example Database:
|
||||
#
|
||||
#employee.fdb = @FB_SAMPLEDBDIR@/employee.fdb
|
||||
#employee = @FB_SAMPLEDBDIR@/employee.fdb
|
||||
# TODO: When added appropriate feature to config - use $(SAMPLEDBDIR) instead
|
||||
employee.fdb = $(root)/examples/empbuild/employee.fdb
|
||||
employee = $(root)/examples/empbuild/employee.fdb
|
||||
employee.fdb = $(dir_sampledb)/employee.fdb
|
||||
employee = $(dir_sampledb)/employee.fdb
|
||||
|
||||
#
|
||||
# Live Databases:
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "../common/config/ConfigCache.h"
|
||||
#include "../common/os/path_utils.h"
|
||||
#include "../common/ScanDir.h"
|
||||
#include "../common/utils_proto.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
@ -471,13 +472,7 @@ bool ConfigFile::translate(const char* fileName, const String& from, String& to)
|
||||
PathUtils::splitLastComponent(path, file, tempPath);
|
||||
to = path.ToString();
|
||||
}
|
||||
/* ToDo - implement this feature
|
||||
else if (!substituteOneOfStandardFirebirdDirs(from, to))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
else
|
||||
else if (!substituteStandardDir(from, to))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -485,6 +480,45 @@ bool ConfigFile::translate(const char* fileName, const String& from, String& to)
|
||||
return true;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Return parameter value as boolean
|
||||
*/
|
||||
|
||||
bool ConfigFile::substituteStandardDir(const String& from, String& to) const
|
||||
{
|
||||
using namespace fb_utils;
|
||||
|
||||
struct Dir {
|
||||
FB_DIR code;
|
||||
const char* name;
|
||||
} dirs[] = {
|
||||
#define NMDIR(a) {a, #a},
|
||||
NMDIR(FB_DIR_CONF)
|
||||
NMDIR(FB_DIR_SECDB)
|
||||
NMDIR(FB_DIR_PLUGINS)
|
||||
NMDIR(FB_DIR_UDF)
|
||||
NMDIR(FB_DIR_SAMPLE)
|
||||
NMDIR(FB_DIR_SAMPLEDB)
|
||||
NMDIR(FB_DIR_INTL)
|
||||
NMDIR(FB_DIR_MSG)
|
||||
#undef NMDIR
|
||||
{FB_DIR_LAST, NULL}
|
||||
};
|
||||
|
||||
for (const Dir* d = dirs; d->name; ++d)
|
||||
{
|
||||
const char* target = &(d->name[3]); // skip FB_
|
||||
if (from.equalsNoCase(target))
|
||||
{
|
||||
to = getPrefix(d->code, "").c_str();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Return parameter corresponding the given key
|
||||
@ -794,6 +828,11 @@ SINT64 ConfigFile::Parameter::asInteger() const
|
||||
return sign * ret;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Return parameter value as boolean
|
||||
*/
|
||||
|
||||
bool ConfigFile::Parameter::asBoolean() const
|
||||
{
|
||||
return (atoi(value.c_str()) != 0) ||
|
||||
|
@ -138,6 +138,7 @@ private:
|
||||
void badLine(const char* fileName, const String& line);
|
||||
void include(const char* currentFileName, const Firebird::PathName& path);
|
||||
bool wildCards(const char* currentFileName, const Firebird::PathName& pathPrefix, FilesArray& components);
|
||||
bool substituteStandardDir(const String& from, String& to) const;
|
||||
};
|
||||
|
||||
#endif // CONFIG_CONFIG_FILE_H
|
||||
|
Loading…
Reference in New Issue
Block a user