Move logfiles to resultDir after evaluation finished

Reimplement the behavior that copies log files to the
`resultDir`, which was most likely lost when restructuring
MiniNDN. Parts of the patch are reused from an old
MiniNDN revision.

Change-Id: I3045237950320d1eb7840af9828459e47f6d9884
diff --git a/minindn/minindn.py b/minindn/minindn.py
index 9921fe6..9a94407 100644
--- a/minindn/minindn.py
+++ b/minindn/minindn.py
@@ -27,6 +27,8 @@
 import os
 import configparser
 from subprocess import call, check_output
+import shutil
+import glob
 
 from mininet.topo import Topo
 from mininet.net import Mininet
@@ -35,6 +37,7 @@
 from mininet.util import ipStr, ipParse
 from mininet.log import info, error
 
+
 class Minindn(object):
     """ This class provides the following features to the user:
         1) Wrapper around Mininet object with option to pass topology directly
@@ -95,7 +98,7 @@
         try:
             Minindn.ndnSecurityDisabled = '/dummy/KEY/-%9C%28r%B8%AA%3B%60' in \
                                           check_output('ndnsec-get-default -k'.split()). \
-                                          decode('utf-8').split('\n')
+                                              decode('utf-8').split('\n')
             info('Dummy key chain patch is installed in ndn-cxx. Security will be disabled.\n')
         except:
             pass
@@ -146,7 +149,7 @@
         for item in items:
             name = item[0].split(':')[0]
             if item[1] in coordinates:
-                error("FATAL: Duplicate Coordinate, \"{}\" used by multiple nodes\n" \
+                error("FATAL: Duplicate Coordinate, \'{}\' used by multiple nodes\n" \
                      .format(item[1]))
                 sys.exit(1)
             coordinates.append(item[1])
@@ -195,6 +198,12 @@
             cleanup()
         self.net.stop()
 
+        if self.resultDir is not None:
+            info("Moving results to \'{}\'\n".format(self.resultDir))
+            os.system("mkdir -p {}".format(self.resultDir))
+            for file in glob.glob('{}/*'.format(self.workDir)):
+                shutil.move(file, self.resultDir)
+
     @staticmethod
     def cleanUp():
         devnull = open(os.devnull, 'w')