src/eric7/DebugClients/Python/coverage/data.py

branch
eric7
changeset 9374
ed79209469ad
parent 9252
32dd11232e06
diff -r e074358157f4 -r ed79209469ad src/eric7/DebugClients/Python/coverage/data.py
--- a/src/eric7/DebugClients/Python/coverage/data.py	Sat Oct 01 17:30:55 2022 +0200
+++ b/src/eric7/DebugClients/Python/coverage/data.py	Sat Oct 01 17:37:10 2022 +0200
@@ -70,7 +70,7 @@
         if os.path.isfile(p):
             files_to_combine.append(os.path.abspath(p))
         elif os.path.isdir(p):
-            pattern = os.path.join(os.path.abspath(p), f"{local}.*")
+            pattern = glob.escape(os.path.join(os.path.abspath(p), local)) +".*"
             files_to_combine.extend(glob.glob(pattern))
         else:
             raise NoDataError(f"Couldn't combine from non-existent path '{p}'")
@@ -132,7 +132,14 @@
             data.update(new_data, aliases=aliases)
             files_combined += 1
             if message:
-                message(f"Combined data file {os.path.relpath(f)}")
+                try:
+                    file_name = os.path.relpath(f)
+                except ValueError:
+                    # ValueError can be raised under Windows when os.getcwd() returns a
+                    # folder from a different drive than the drive of f, in which case
+                    # we print the original value of f instead of its relative path
+                    file_name = f
+                message(f"Combined data file {file_name}")
             if not keep:
                 if data._debug.should('dataio'):
                     data._debug.write(f"Deleting combined data file {f!r}")

eric ide

mercurial