Commits

Roman Haritonov  committed 8954b3e

include_files: Consistent behaviour for empty target directory and file. Fix for 'foodir/' (trailng path sep eats one letter of subfolder)

  • Participants
  • Parent commits f3cacc2

Comments (0)

Files changed (1)

File cx_Freeze/freezer.py

         processedSpecs = []
         for spec in specs:
             if not isinstance(spec, (list, tuple)):
-                processedSpecs.append((spec, spec))
+                source = target = spec
             elif len(spec) != 2:
                 raise ConfigError("path spec must be a list or tuple of "
                         "length two")
             else:
-                processedSpecs.append(spec)
+                source, target = spec
+            source = os.path.normpath(source)
+            if not target:
+                target = os.path.split(source)[1]
+            processedSpecs.append((source, target))
         return processedSpecs
 
     def _RemoveFile(self, path):
             self._WriteModules(fileName, self.initScript, self.finder,
                     self.compress, self.copyDependentFiles)
         for sourceFileName, targetFileName in self.includeFiles:
-            fullName = os.path.join(self.targetDir, targetFileName)
             if os.path.isdir(sourceFileName):
                 for path, dirNames, fileNames in os.walk(sourceFileName):
                     shortPath = path[len(sourceFileName) + 1:]
                         self._CopyFile(fullSourceName, fullTargetName,
                                 copyDependentFiles = False)
             else:
+                fullName = os.path.join(self.targetDir, targetFileName)
                 self._CopyFile(sourceFileName, fullName,
                         copyDependentFiles = False)