tmf: Fix existing trace not being reopened when it as a short path (Win)
authorMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Fri, 11 Dec 2015 19:53:23 +0000 (14:53 -0500)
committerMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Mon, 14 Dec 2015 01:55:44 +0000 (20:55 -0500)
This fixes the TestTraceOffsetting test.

On Windows, the temporary path can look like this:
java.io.tmpdir=C:\Users\MARC-A~1\AppData\Local\Temp\ Which is a "short
path". When used in comparison with full, canonical paths, it fails.

In the context of this bug, because the comparison failed, it ended up
creating a second trace for the same location then the test could not
find the proper editor because the title contained a '(2)'.

Change-Id: I41def2180ff910e25489415c9de513212d2f2ea2
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/62529
Reviewed-by: Hudson CI
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfOpenTraceHelper.java

index 276ad402bcf6bbfc5465f8a81721756d45709fa5..1541440878402d6e6fa21018de7c7f01a879dc5e 100644 (file)
@@ -186,7 +186,12 @@ public class TmfOpenTraceHelper {
         final IResource candidate = folder.findMember(name);
         if (candidate != null) {
             final IPath rawLocation = candidate.getRawLocation();
-            final File file = rawLocation.toFile();
+            File file = rawLocation.toFile();
+            try {
+                file = traceFile.getCanonicalFile();
+            } catch (IOException e) {
+                /* just use original file path */
+            }
             return !file.equals(traceFile);
         }
         return false;
This page took 0.026419 seconds and 5 git commands to generate.