tmf: Use OSString for the supplementary files folder property
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Thu, 14 May 2015 20:13:18 +0000 (16:13 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Tue, 19 May 2015 15:33:32 +0000 (11:33 -0400)
On Windows, getLocationURI().getPath() returns a string that
starts with "/C:/...". This does not get parsed correctly by
utilities like java.nio.file.Path.

Using getLocation().toOSString() instead solves this problem.

Change-Id: I7c5d6d43cd21fd9c0021105884f61fb32bd133d5
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/47932
Reviewed-by: Hudson CI
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/synchronization/TimeOffsetTest.java
org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/trace/TmfTraceManager.java
org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfCommonProjectElement.java

index d9b63b6348e2ddcb4a09d904a0b588d9f5ec4f69..b2ff1b2ea7a9b5c46a8201fba1c7730307c90df8 100644 (file)
@@ -80,7 +80,7 @@ public class TimeOffsetTest {
             final InputStream source = new ByteArrayInputStream(new byte[0]);
             fResource.create(source, true, null);
         }
-        fResource.setPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, fResource.getParent().getLocationURI().getPath());
+        fResource.setPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, fResource.getParent().getLocation().toOSString());
     }
 
     @After
index 474a0cd32d5e0c330f60acc12d03bbcb4d959689..71bd80d38b5ef7930f13d1723a7922175ce0e0ac 100644 (file)
@@ -251,7 +251,7 @@ public final class TmfTraceManager {
             String supplFolderPath = getSupplementaryFileDir(trace);
             IProject project = resource.getProject();
             /* Remove the project's path from the supplementary path dir */
-            if (!supplFolderPath.startsWith(project.getLocationURI().getPath())) {
+            if (!supplFolderPath.startsWith(project.getLocation().toOSString())) {
                 Activator.logWarning(String.format("Supplementary files folder for trace %s is not within the project.", trace.getName())); //$NON-NLS-1$
                 return;
             }
index 041ca4df182bde20eb37ba5d470024bd0791bfda..1e7403324c5bda19874937aa768fdde98a8f12b6 100644 (file)
@@ -539,7 +539,7 @@ public abstract class TmfCommonProjectElement extends TmfProjectModelElement {
         IFolder supplFolder = prepareTraceSupplementaryFolder(getSupplementaryFolderPath(), true);
 
         try {
-            fResource.setPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, supplFolder.getLocationURI().getPath());
+            fResource.setPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, supplFolder.getLocation().toOSString());
         } catch (CoreException e) {
             Activator.getDefault().logError("Error setting persistant property " + TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, e); //$NON-NLS-1$
         }
This page took 0.031828 seconds and 5 git commands to generate.