diff --git a/src/core/utils/RbFileManager.cpp b/src/core/utils/RbFileManager.cpp index 60738683d..432a0d4b5 100644 --- a/src/core/utils/RbFileManager.cpp +++ b/src/core/utils/RbFileManager.cpp @@ -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 ); diff --git a/src/revlanguage/functions/io/Func_source.cpp b/src/revlanguage/functions/io/Func_source.cpp index a859ba7f2..5cd2f0f7e 100644 --- a/src/revlanguage/functions/io/Func_source.cpp +++ b/src/revlanguage/functions/io/Func_source.cpp @@ -41,8 +41,12 @@ RevPtr Func_source::execute( void ) /* Open file */ std::string fname = static_cast( 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( args[1].getVariable()->getRevObject() ).getValue(); @@ -63,7 +67,6 @@ RevPtr Func_source::execute( void ) // Read a line std::string line; - RevBayesCore::RbFileManager reader = RevBayesCore::RbFileManager(); reader.safeGetline(inFile, line); lineNumber++;