MCPcopy Create free account
hub / github.com/SpartanJ/eepp / loadFromFile

Method loadFromFile

src/eepp/ui/doc/textdocument.cpp:831–858  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

829}
830
831TextDocument::LoadStatus TextDocument::loadFromFile( const std::string& path ) {
832 mLoading = true;
833 bool fileExists = FileSystem::fileExists( path );
834
835 if ( !fileExists && PackManager::instance()->isFallbackToPacksActive() ) {
836 std::string pathFix( path );
837 Pack* pack = PackManager::instance()->exists( pathFix );
838 if ( NULL != pack ) {
839 changeFilePath( pathFix, false );
840 return loadFromPack( pack, pathFix );
841 }
842 }
843
844 LoadStatus ret = LoadStatus::Failed;
845 if ( fileExists ) {
846 IOStreamFile file( path, "rb" );
847 ret = loadFromStream( file, path, true );
848 } else {
849 setDirtyUntilSave();
850 }
851
852 changeFilePath( path, false );
853 resetSyntax();
854 mLoading = false;
855 if ( !mLoadingAsync )
856 notifyDocumentLoaded();
857 return ret;
858}
859
860bool TextDocument::loadAsyncFromFile( const std::string& path, std::shared_ptr<ThreadPool> pool,
861 std::function<void( TextDocument*, bool )> onLoaded ) {

Callers

nothing calls this directly

Calls 1

existsMethod · 0.45

Tested by

no test coverage detected