1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-02 05:45:58 +02:00

The previous fix for Linux broke the tests on Windows. This time it's a cross-platform fix.

This commit is contained in:
Sergey Prigogin 2010-05-10 00:04:12 +00:00
parent f20d5d974c
commit 5b90e13d79

View file

@ -14,6 +14,7 @@ import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -146,8 +147,7 @@ public class IndexLocationTest extends BaseTestCase {
ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(cproject.getProject().getName()+"/source.cpp")).getFullPath(), ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(cproject.getProject().getName()+"/source.cpp")).getFullPath(),
new Path(nms3[0].getFile().getLocation().getFullPath()) new Path(nms3[0].getFile().getLocation().getFullPath())
); );
} } finally {
finally {
index.releaseReadLock(); index.releaseReadLock();
} }
} finally { } finally {
@ -291,7 +291,7 @@ public class IndexLocationTest extends BaseTestCase {
"/"+cproject.getProject().getName()+"/a /b /c.d", "/"+cproject.getProject().getName()+"/a /b /c.d",
"/"+cproject.getProject().getName()+"/a b c/d-e/f.g" "/"+cproject.getProject().getName()+"/a b c/d-e/f.g"
}; };
URI base = URI.create("file://" + basePath); URI base = makeDirectoryURI(basePath);
URIRelativeLocationConverter c1 = new URIRelativeLocationConverter(base); URIRelativeLocationConverter c1 = new URIRelativeLocationConverter(base);
// loc -project-> raw -uri-> loc // loc -project-> raw -uri-> loc
for (int i= 0; i < paths.length; i++) { for (int i= 0; i < paths.length; i++) {
@ -329,7 +329,7 @@ public class IndexLocationTest extends BaseTestCase {
linkedFolder.getFullPath()+"/a b c/d-e/f.g" linkedFolder.getFullPath()+"/a b c/d-e/f.g"
}; };
// loc -project-> raw -uri-> loc // loc -project-> raw -uri-> loc
URI base = URI.create("file://" + basePath); URI base = makeDirectoryURI(basePath);
URIRelativeLocationConverter c1 = new URIRelativeLocationConverter(base); URIRelativeLocationConverter c1 = new URIRelativeLocationConverter(base);
for (int i= 0; i < paths.length; i++) { for (int i= 0; i < paths.length; i++) {
IFile file= linkedFolder.getFile(paths[i]); IFile file= linkedFolder.getFile(paths[i]);
@ -357,4 +357,9 @@ public class IndexLocationTest extends BaseTestCase {
fos.write(content.getBytes()); fos.write(content.getBytes());
fos.close(); fos.close();
} }
private URI makeDirectoryURI(String dir) throws URISyntaxException {
URI uri = new File(dir).toURI();
return new URI(uri.toString() + "/");
}
} }