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

Method loadFileFromPath

src/eepp/ui/tools/uicodeeditorsplitter.cpp:390–408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

388}
389
390bool UICodeEditorSplitter::loadFileFromPath( const std::string& path, UICodeEditor* codeEditor ) {
391 if ( FileSystem::isDirectory( path ) )
392 return false;
393 if ( nullptr == codeEditor )
394 codeEditor = mCurEditor;
395 if ( nullptr == codeEditor && !mTabWidgets.empty() )
396 codeEditor = createCodeEditorInTabWidget( mTabWidgets[0] ).second;
397 codeEditor->setColorScheme( mColorSchemes[mCurrentColorScheme] );
398 bool isUrl = String::startsWith( path, "https://" ) || String::startsWith( path, "http://" );
399 bool ret = isUrl ? codeEditor->loadAsyncFromURL(
400 path, Http::Request::FieldTable(),
401 [this, codeEditor, path]( std::shared_ptr<TextDocument>, bool ) {
402 mClient->onDocumentLoaded( codeEditor, path );
403 } )
404 : codeEditor->loadFromFile( path ) == TextDocument::LoadStatus::Loaded;
405 if ( ret && !isUrl )
406 mClient->onDocumentLoaded( codeEditor, path );
407 return ret;
408}
409
410void UICodeEditorSplitter::loadAsyncFileFromPath(
411 const std::string& path, UICodeEditor* codeEditor,

Callers

nothing calls this directly

Calls 5

emptyMethod · 0.45
setColorSchemeMethod · 0.45
loadAsyncFromURLMethod · 0.45
onDocumentLoadedMethod · 0.45
loadFromFileMethod · 0.45

Tested by

no test coverage detected