From: Marc-Andre Laperle Date: Fri, 11 Dec 2015 19:53:23 +0000 (-0500) Subject: tmf: Fix existing trace not being reopened when it as a short path (Win) X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=f278fbd44a2bdcbd7239293e862472bb3715e331;p=deliverable%2Ftracecompass.git tmf: Fix existing trace not being reopened when it as a short path (Win) 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 Reviewed-on: https://git.eclipse.org/r/62529 Reviewed-by: Hudson CI Reviewed-by: Patrick Tasse Tested-by: Patrick Tasse --- diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfOpenTraceHelper.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfOpenTraceHelper.java index 276ad402bc..1541440878 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfOpenTraceHelper.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfOpenTraceHelper.java @@ -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;