got rid of all the absolute paths in the fitpc code
Previously, there were 2 places (BinaryLogReader and the HTTP file server) that
had "/home/driver/" hard coded. I changed both of those to use paths relative to
the location of the executable (retrieved from /proc/self/exe).
git-svn-id: https://robotics.mvla.net/svn/frc971/2013/trunk/src@4162 f308d9b7-e957-4cde-b6ac-9a88185e7312
diff --git a/aos/atom_code/output/ctemplate_cache.cc b/aos/atom_code/output/ctemplate_cache.cc
new file mode 100644
index 0000000..a73e4ad
--- /dev/null
+++ b/aos/atom_code/output/ctemplate_cache.cc
@@ -0,0 +1,24 @@
+#include "aos/atom_code/output/ctemplate_cache.h"
+
+#include "aos/common/Configuration.h"
+#include "aos/common/once.h"
+
+namespace aos {
+namespace http {
+
+namespace {
+ctemplate::TemplateCache *CreateTemplateCache() {
+ ctemplate::TemplateCache *r = new ctemplate::TemplateCache();
+
+ r->SetTemplateRootDirectory(configuration::GetRootDirectory());
+
+ return r;
+}
+} // namespace
+ctemplate::TemplateCache *get_template_cache() {
+ static Once<ctemplate::TemplateCache> once(CreateTemplateCache);
+ return once.Get();
+}
+
+} // namespace http
+} // namespace aos
diff --git a/aos/atom_code/output/ctemplate_cache.h b/aos/atom_code/output/ctemplate_cache.h
new file mode 100644
index 0000000..7e5dc3d
--- /dev/null
+++ b/aos/atom_code/output/ctemplate_cache.h
@@ -0,0 +1,12 @@
+#include "ctemplate/template_cache.h"
+
+namespace aos {
+namespace http {
+
+// Retrieves the cache used by all of the aos functions etc.
+// This cache will have its root directory set to the directory where the
+// executable is running from.
+ctemplate::TemplateCache *get_template_cache();
+
+} // namespace http
+} // namespace aos
diff --git a/aos/atom_code/output/output.gyp b/aos/atom_code/output/output.gyp
index 3e4abd4..d41fe7d 100644
--- a/aos/atom_code/output/output.gyp
+++ b/aos/atom_code/output/output.gyp
@@ -6,11 +6,13 @@
'sources': [
'HTTPServer.cpp',
'evhttp_ctemplate_emitter.cc',
+ 'ctemplate_cache.cc',
],
'dependencies': [
'<(AOS)/build/aos.gyp:libaos',
'<(EXTERNALS):libevent',
'<(EXTERNALS):ctemplate',
+ '<(AOS)/common/common.gyp:once',
],
'export_dependent_settings': [
# Our headers #include headers from both of these.