|
|
|
@ -968,7 +968,7 @@ bool FileManager::deleteBufferBackup(BufferID id)
|
|
|
|
|
|
|
|
|
|
std::mutex save_mutex;
|
|
|
|
|
|
|
|
|
|
bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy, generic_string * error_msg)
|
|
|
|
|
SavingStatus FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> lock(save_mutex);
|
|
|
|
|
|
|
|
|
@ -1005,7 +1005,12 @@ bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy, g
|
|
|
|
|
int encoding = buffer->getEncoding();
|
|
|
|
|
|
|
|
|
|
FILE *fp = UnicodeConvertor.fopen(fullpath, TEXT("wbc"));
|
|
|
|
|
if (fp)
|
|
|
|
|
|
|
|
|
|
if (!fp)
|
|
|
|
|
{
|
|
|
|
|
return SavingStatus::SaveOpenFailed;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_pscratchTilla->execute(SCI_SETDOCPOINTER, 0, buffer->_doc); //generate new document
|
|
|
|
|
|
|
|
|
@ -1048,11 +1053,7 @@ bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy, g
|
|
|
|
|
if (items_written != 1)
|
|
|
|
|
{
|
|
|
|
|
_pscratchTilla->execute(SCI_SETDOCPOINTER, 0, _scratchDocDefault);
|
|
|
|
|
|
|
|
|
|
if (error_msg != NULL)
|
|
|
|
|
*error_msg = TEXT("Failed to save file.\nNot enough space on disk to save file?");
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
return SavingStatus::SaveWrittingFailed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isHiddenOrSys)
|
|
|
|
@ -1061,19 +1062,7 @@ bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy, g
|
|
|
|
|
if (isCopy) // Save As command
|
|
|
|
|
{
|
|
|
|
|
_pscratchTilla->execute(SCI_SETDOCPOINTER, 0, _scratchDocDefault);
|
|
|
|
|
|
|
|
|
|
/* for saveAs it's not necessary since this action is for the "current" directory, so we let manage in SAVEPOINTREACHED event
|
|
|
|
|
generic_string backupFilePath = buffer->getBackupFileName();
|
|
|
|
|
if (not backupFilePath.empty())
|
|
|
|
|
{
|
|
|
|
|
// delete backup file
|
|
|
|
|
generic_string file2Delete = buffer->getBackupFileName();
|
|
|
|
|
buffer->setBackupFileName(generic_string());
|
|
|
|
|
::DeleteFile(file2Delete.c_str());
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
return true; //all done
|
|
|
|
|
return SavingStatus::SaveOK; //all done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buffer->setFileName(fullpath, language);
|
|
|
|
@ -1091,10 +1080,8 @@ bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy, g
|
|
|
|
|
::DeleteFile(backupFilePath.c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
return SavingStatus::SaveOK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
size_t FileManager::nextUntitledNewNumber() const
|
|
|
|
|