summaryrefslogtreecommitdiff
path: root/textual.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2006-03-15 11:54:18 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:41:30 -0400
commit2964dd15b24787162c53560ae9ceae5a92cfc86d (patch)
treef3421c6773e460aa1c0b9e6d8e793b5efb88818d /textual.cc
parent30f79b07618872b7326742430e03795da5782860 (diff)
downloadfork-ledger-2964dd15b24787162c53560ae9ceae5a92cfc86d.tar.gz
fork-ledger-2964dd15b24787162c53560ae9ceae5a92cfc86d.tar.bz2
fork-ledger-2964dd15b24787162c53560ae9ceae5a92cfc86d.zip
*** empty log message ***
Diffstat (limited to 'textual.cc')
-rw-r--r--textual.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/textual.cc b/textual.cc
index cd0b9b28..29b548e5 100644
--- a/textual.cc
+++ b/textual.cc
@@ -21,7 +21,7 @@
#include <cstdio>
#include <cstdlib>
-#if defined(__GNUG__) && __GNUG__ < 3
+#ifdef HAVE_REALPATH
extern "C" char *realpath(const char *, char resolved_path[]);
#endif
@@ -737,13 +737,15 @@ unsigned int textual_parser_t::parse(std::istream& in,
push_var<unsigned int> save_linenum(linenum);
path = p;
- if (path[0] != '/' && path[0] != '\\') {
+ if (path[0] != '/' && path[0] != '\\' && path[0] != '~') {
std::string::size_type pos = save_path.prev.rfind('/');
if (pos == std::string::npos)
pos = save_path.prev.rfind('\\');
if (pos != std::string::npos)
path = std::string(save_path.prev, 0, pos + 1) + path;
}
+ path = resolve_path(path);
+
DEBUG_PRINT("ledger.textual.include", "line " << linenum << ": " <<
"Including path '" << path << "'");
@@ -783,7 +785,7 @@ unsigned int textual_parser_t::parse(std::istream& in,
else if (word == "def") {
if (! global_scope.get())
init_value_expr();
- value_auto_ptr expr(parse_boolean_expr(p, global_scope.get()));
+ parse_value_definition(p);
}
break;
}
@@ -856,10 +858,11 @@ void write_textual_journal(journal_t& journal, std::string path,
{
unsigned long index = 0;
std::string found;
- char buf1[PATH_MAX];
- char buf2[PATH_MAX];
#ifdef HAVE_REALPATH
+ char buf1[PATH_MAX];
+ char buf2[PATH_MAX];
+
::realpath(path.c_str(), buf1);
for (strings_list::iterator i = journal.sources.begin();
i != journal.sources.end();