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

Commit 227528e

Browse files
committed
Small edit to source function to use full path including current working directory
1 parent 324c845 commit 227528e

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/core/utils/RbFileManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ bool RbFileManager::openFile(std::ifstream& strm)
626626

627627
// concatenate path and file name
628628
std::string file_pathName = file_path + path_separator + file_name;
629-
629+
630630
// here we assume that the presence of the path/file has
631631
// been checked elsewhere
632632
strm.open( file_pathName.c_str(), std::ios::in );

src/revlanguage/functions/io/Func_source.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,12 @@ RevPtr<RevVariable> Func_source::execute( void )
4141

4242
/* Open file */
4343
std::string fname = static_cast<const RlString &>( args[0].getVariable()->getRevObject() ).getValue();
44-
std::ifstream inFile( fname.c_str() );
45-
44+
45+
RevBayesCore::RbFileManager reader = RevBayesCore::RbFileManager(fname);
46+
std::ifstream inFile;
47+
48+
// now open the stream
49+
reader.openFile(inFile);
4650

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

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

6468
// Read a line
6569
std::string line;
66-
RevBayesCore::RbFileManager reader = RevBayesCore::RbFileManager();
6770
reader.safeGetline(inFile, line);
6871
lineNumber++;
6972

0 commit comments

Comments
 (0)