Changeset 19456


Ignore:
Timestamp:
Mar 28, 2019, 9:26:04 PM (3 weeks ago)
Author:
tbretz
Message:
Use the script location as the root path for relative file locations.
Location:
trunk/FACT++/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/InterpreterV8.cc

    r18978 r19456  
    1010
    1111#include <boost/tokenizer.hpp>
     12#include <boost/filesystem.hpp>
    1213#include <boost/algorithm/string/join.hpp>
    1314
     
    745746        return ThrowException(String::New("File name empty."));
    746747
    747     izstream fin(*file);
     748    const auto path = boost::filesystem::path(*file);
     749
     750    const auto f = path.is_absolute() ? path : boost::filesystem::path(fIncludePath)/path;
     751
     752    izstream fin(f.string().c_str());
    748753    if (!fin)
    749754        return ThrowException(String::New(errno!=0?strerror(errno):"Insufficient memory for decompression"));
     
    780785    HandleScope handle_scope;
    781786
    782     izstream fin(*file);
     787    const auto path = boost::filesystem::path(*file);
     788
     789    const auto f = path.is_absolute() ? path : boost::filesystem::path(fIncludePath)/path;
     790
     791    izstream fin(f.string().c_str());
    783792    if (!fin)
    784793        return ThrowException(String::New(errno!=0?strerror(errno):"Insufficient memory for decompression"));
     
    28042813        else
    28052814        {
     2815            fIncludePath = boost::filesystem::path(filename).parent_path().string();
     2816
    28062817            // We call script->Run because it is the only way to
    28072818            // catch exceptions.
  • trunk/FACT++/src/InterpreterV8.h

    r18828 r19456  
    5858    std::list<Database*> fDatabases;
    5959#endif
     60
     61    std::string fIncludePath;
    6062
    6163#ifdef HAVE_V8
Note: See TracChangeset for help on using the changeset viewer.