blob: 0f261154e78d7960f77949898b83e65956c2e5d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package org.javacs;
import java.io.File;
import java.net.URI;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
* Find java sources in test-project/workspace/src
*/
public class FindResource {
public static URI uri(String resourcePath) {
if (resourcePath.startsWith("/"))
resourcePath = resourcePath.substring(1);
Path path = Paths.get("./src/test/test-project/workspace/src").resolve(resourcePath).normalize();
File file = path.toFile();
if (!file.exists())
throw new RuntimeException(file + " does not exist");
return file.toURI();
}
}
|