OSDN Git Service

Add deletion of files in res for security enhancement.
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / NeverNote.java
index 5842a5c..c503d64 100644 (file)
@@ -963,8 +963,10 @@ public class NeverNote extends QMainWindow{
                                indexRunner.thread().join(50);
                        if (!indexRunner.thread().isAlive())
                                logger.log(logger.MEDIUM, "Index thread has stopped");
-                       else
-                               logger.log(logger.MEDIUM, "Index thread still running - bypassing");
+                       else {
+                               logger.log(logger.MEDIUM, "Index thread still running - interrupting");
+                               indexRunner.thread().interrupt();
+                       }
                } catch (InterruptedException e1) {
                        e1.printStackTrace();
                }
@@ -984,6 +986,12 @@ public class NeverNote extends QMainWindow{
                if (decryptOnShutdown) {
                        decryptOnShutdown();
                }
+               try {
+                       Global.getFileManager().purgeResDirectory(false);
+               } catch (InitializationException e) {
+                       System.out.println(tr("Empty res directory purge failed"));
+                       e.printStackTrace();
+               }
                logger.log(logger.HIGH, "Leaving NeverNote.closeEvent");
        }
 
@@ -5413,7 +5421,7 @@ public class NeverNote extends QMainWindow{
                
        ImportData noteReader = new ImportData(conn, false);
        String fileName = fd.selectedFiles().get(0);
-       saveLastPath.substring(0,fileName.lastIndexOf("/"));
+//     saveLastPath.substring(0,fileName.lastIndexOf("/"));
 
        if (!fileName.endsWith(".nnex"))
                fileName = fileName +".nnex";