else
{
// create backupfiles object and get new temp filename destination
- BackupFiles backupfiles = new BackupFiles(file);
+ boolean doBackup = BackupFiles.getEnabled();
+ BackupFiles backupfiles = doBackup ? new BackupFiles(file) : null;
try
{
- String tempFilePath = backupfiles.getTempFilePath();
+ String tempFilePath = doBackup ? backupfiles.getTempFilePath() : file;
PrintWriter out = new PrintWriter(
new FileWriter(tempFilePath));
statusBar.setText(MessageManager.formatMessage(
"label.successfully_saved_to_file_in_format", new Object[]
{ fileName, format.getName() }));
+ lastSaveSuccessful = true;
} catch (Exception ex)
{
lastSaveSuccessful = false;
ex.printStackTrace();
}
- backupfiles.setWriteSuccess(lastSaveSuccessful);
- // do the backup file roll and rename the temp file to actual file
- lastSaveSuccessful = backupfiles.rollBackupsAndRenameTempFile();
+ if (doBackup)
+ {
+ backupfiles.setWriteSuccess(lastSaveSuccessful);
+ // do the backup file roll and rename the temp file to actual file
+ lastSaveSuccessful = backupfiles.rollBackupsAndRenameTempFile();
+ }
}
}
};
// TODO prevent user from messing with the Desktop whilst we're saving
try
{
- BackupFiles backupfiles = new BackupFiles(chosenFile);
+ boolean doBackup = BackupFiles.getEnabled();
+ BackupFiles backupfiles = doBackup ? new BackupFiles(chosenFile) : null;
- new Jalview2XML().saveState(backupfiles.getTempFile());
+ new Jalview2XML().saveState(doBackup ? backupfiles.getTempFile() : chosenFile);
- backupfiles.setWriteSuccess(true);
- backupfiles.rollBackupsAndRenameTempFile();
+ if (doBackup)
+ {
+ backupfiles.setWriteSuccess(true);
+ backupfiles.rollBackupsAndRenameTempFile();
+ }
} catch (OutOfMemoryError oom)
{
new OOMWarning("Whilst saving current state to "
import jalview.gui.Desktop;
import jalview.gui.JvOptionPane;
import jalview.util.MessageManager;
+import jalview.util.Platform;
import java.io.File;
import java.io.IOException;
public static void classInit()
{
- setEnabled(Cache.getDefault(ENABLED, true));
+ setEnabled(Cache.getDefault(ENABLED, !Platform.isJS()));
setConfirmDelete(Cache.getDefault(CONFIRM_DELETE_OLD, true));
}
try
{
// create backupfiles object and get new temp filename destination
- BackupFiles backupfiles = new BackupFiles(jarFile);
- FileOutputStream fos = new FileOutputStream(
- backupfiles.getTempFilePath());
+ boolean doBackup = BackupFiles.getEnabled();
+ BackupFiles backupfiles = doBackup ? new BackupFiles(jarFile) : null;
+ FileOutputStream fos = new FileOutputStream(doBackup ?
+ backupfiles.getTempFilePath() : jarFile);
JarOutputStream jout = new JarOutputStream(fos);
List<AlignFrame> frames = new ArrayList<>();
jout.close();
boolean success = true;
- backupfiles.setWriteSuccess(success);
- success = backupfiles.rollBackupsAndRenameTempFile();
+ if (doBackup)
+ {
+ backupfiles.setWriteSuccess(success);
+ success = backupfiles.rollBackupsAndRenameTempFile();
+ }
return success;
} catch (Exception ex)