Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilchowdary committed Feb 26, 2017
1 parent fe089cf commit 3432a66
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -898,13 +898,21 @@ private String saveDraft() {
oldFile = new File(oldFileName);

FileUtils.saveXmlFile(toolkit.getDraftDir(), ".temp", doc);
if (oldFile == null || !FileUtils.equalContent(tempFile, oldFile)) {

if(oldFile == null){
tempFile.renameTo(probableFile);
return toolkit.getDraftDir() + probableFileName;
} else {
}
else if (!FileUtils.equalContent(tempFile, oldFile)){
tempFile.renameTo(probableFile);
oldFile.delete();
return toolkit.getDraftDir() + probableFileName;
}
else {
File newFile = new File(toolkit.getDraftDir(), ".temp");
newFile.delete();
}

return null;

} catch (ParserConfigurationException | NullPointerException e) {
Expand Down Expand Up @@ -981,7 +989,7 @@ private void parseSavedFile(String path) {
File draftDir = new File(toolkit.getDraftDir());
if (fXmlFile.getParentFile().compareTo(draftDir) == 0) {
//If Draft File
fXmlFile.delete();
// fXmlFile.delete();
}
setUpActionBar();

Expand Down

0 comments on commit 3432a66

Please sign in to comment.