|
From: <ale...@us...> - 2013-03-28 15:35:32
|
Revision: 57864
http://sourceforge.net/p/firebird/code/57864
Author: alexpeshkoff
Date: 2013-03-28 15:35:29 +0000 (Thu, 28 Mar 2013)
Log Message:
-----------
Added macros for main firebird directories to config files
Modified Paths:
--------------
firebird/trunk/builds/install/misc/aliases.conf.in
firebird/trunk/src/common/config/config_file.cpp
firebird/trunk/src/common/config/config_file.h
Modified: firebird/trunk/builds/install/misc/aliases.conf.in
===================================================================
--- firebird/trunk/builds/install/misc/aliases.conf.in 2013-03-28 13:55:16 UTC (rev 57863)
+++ firebird/trunk/builds/install/misc/aliases.conf.in 2013-03-28 15:35:29 UTC (rev 57864)
@@ -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:
Modified: firebird/trunk/src/common/config/config_file.cpp
===================================================================
--- firebird/trunk/src/common/config/config_file.cpp 2013-03-28 13:55:16 UTC (rev 57863)
+++ firebird/trunk/src/common/config/config_file.cpp 2013-03-28 15:35:29 UTC (rev 57864)
@@ -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,18 +472,51 @@
PathUtils::splitLastComponent(path, file, tempPath);
to = path.ToString();
}
- /* ToDo - implement this feature
- else if (!substituteOneOfStandardFirebirdDirs(from, to))
+ else if (!substituteStandardDir(from, to))
{
return false;
}
- */
- else
+
+ 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)
{
- return false;
+ const char* target = &(d->name[3]); // skip FB_
+ if (from.equalsNoCase(target))
+ {
+ to = getPrefix(d->code, "").c_str();
+ return true;
+ }
}
- return true;
+ return false;
}
/******************************************************************************
@@ -794,6 +828,11 @@
return sign * ret;
}
+/******************************************************************************
+ *
+ * Return parameter value as boolean
+ */
+
bool ConfigFile::Parameter::asBoolean() const
{
return (atoi(value.c_str()) != 0) ||
Modified: firebird/trunk/src/common/config/config_file.h
===================================================================
--- firebird/trunk/src/common/config/config_file.h 2013-03-28 13:55:16 UTC (rev 57863)
+++ firebird/trunk/src/common/config/config_file.h 2013-03-28 15:35:29 UTC (rev 57864)
@@ -138,6 +138,7 @@
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
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|