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

Method save

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

Source from the content-addressed store, hash-verified

981}
982
983bool TextDocument::save( const std::string& path ) {
984 if ( path.empty() || mDefaultFileName == path || mSaving )
985 return false;
986 mSaving = true;
987 if ( FileSystem::fileWrite( path, "" ) ) {
988 IOStreamFile file( path, "wb" );
989 std::string oldFilePath( mFilePath );
990 URI oldFileURI( mFileURI );
991 FileInfo oldFileInfo( mFileRealPath );
992 mFilePath = path;
993 mFileURI = URI( "file://" + mFilePath );
994 if ( save( file ) ) {
995 file.close();
996 mFileRealPath =
997 FileInfo::isLink( mFilePath ) ? FileInfo( mFilePath ).linksTo() : mFilePath;
998 mSaving = false;
999 notifyDocumentSaved();
1000 return true;
1001 } else {
1002 mFilePath = std::move( oldFilePath );
1003 mFileURI = std::move( oldFileURI );
1004 mFileRealPath = std::move( oldFileInfo );
1005 mSaving = false;
1006 }
1007 }
1008 return false;
1009}
1010
1011bool TextDocument::save( IOStream& stream, bool keepUndoRedoStatus ) {
1012 if ( !stream.isOpen() || linesCount() == 0 )

Callers 1

textureAtlasSaveMethod · 0.45

Calls 15

updateFunction · 0.85
insertFunction · 0.85
linksToMethod · 0.80
find_last_not_ofMethod · 0.80
pop_backMethod · 0.80
reserveMethod · 0.80
push_backMethod · 0.80
c_strMethod · 0.80
iconvMethod · 0.80
getPlatformHelperMethod · 0.80
iconvFreeMethod · 0.80
closeMethod · 0.65

Tested by

no test coverage detected