diff options
author | John Wiegley <johnw@newartisans.com> | 2013-04-29 16:36:29 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2013-04-29 16:36:29 -0500 |
commit | 59550b7f66c31592160749c5177074f63d19fa9d (patch) | |
tree | 0b28be9ab403e67d042f74ae9d1d76d885486b18 /src/context.h | |
parent | 385cbd25b9905b16a4c7723bb4e5a5813e84aab0 (diff) | |
parent | 6bef247759acbdc026624e78d0fd78297bc79501 (diff) | |
download | fork-ledger-59550b7f66c31592160749c5177074f63d19fa9d.tar.gz fork-ledger-59550b7f66c31592160749c5177074f63d19fa9d.tar.bz2 fork-ledger-59550b7f66c31592160749c5177074f63d19fa9d.zip |
Merge branch 'next'
Diffstat (limited to 'src/context.h')
-rw-r--r-- | src/context.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/context.h b/src/context.h index 09734b3e..e5457641 100644 --- a/src/context.h +++ b/src/context.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2012, John Wiegley. All rights reserved. + * Copyright (c) 2003-2013, John Wiegley. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -112,16 +112,16 @@ inline parse_context_t open_for_reading(const path& pathname, const path& cwd) { path filename = resolve_path(pathname); - - if (! exists(filename)) - throw_(std::runtime_error, - _f("Cannot read journal file %1%") % filename); - #if BOOST_VERSION >= 104600 && BOOST_FILESYSTEM_VERSION >= 3 - path parent(filesystem::absolute(pathname, cwd).parent_path()); + filename = filesystem::absolute(filename, cwd); #else - path parent(filesystem::complete(pathname, cwd).parent_path()); + filename = filesystem::complete(filename, cwd); #endif + if (! exists(filename) || is_directory(filename)) + throw_(std::runtime_error, + _f("Cannot read journal file %1%") % filename); + + path parent(filename.parent_path()); shared_ptr<std::istream> stream(new ifstream(filename)); parse_context_t context(stream, parent); context.pathname = filename; |