Skip to content
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.

Commit

Permalink
Small edit to source function to use full path including current work…
Browse files Browse the repository at this point in the history
…ing directory
  • Loading branch information
hoehna committed Apr 16, 2018
1 parent 324c845 commit 227528e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/core/utils/RbFileManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ bool RbFileManager::openFile(std::ifstream& strm)

// concatenate path and file name
std::string file_pathName = file_path + path_separator + file_name;

// here we assume that the presence of the path/file has
// been checked elsewhere
strm.open( file_pathName.c_str(), std::ios::in );
Expand Down
9 changes: 6 additions & 3 deletions src/revlanguage/functions/io/Func_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@ RevPtr<RevVariable> Func_source::execute( void )

/* Open file */
std::string fname = static_cast<const RlString &>( args[0].getVariable()->getRevObject() ).getValue();
std::ifstream inFile( fname.c_str() );


RevBayesCore::RbFileManager reader = RevBayesCore::RbFileManager(fname);
std::ifstream inFile;

// now open the stream
reader.openFile(inFile);

bool echo_on = static_cast<const RlBoolean &>( args[1].getVariable()->getRevObject() ).getValue();

Expand All @@ -63,7 +67,6 @@ RevPtr<RevVariable> Func_source::execute( void )

// Read a line
std::string line;
RevBayesCore::RbFileManager reader = RevBayesCore::RbFileManager();
reader.safeGetline(inFile, line);
lineNumber++;

Expand Down

0 comments on commit 227528e

Please sign in to comment.