- private Resource getParent(Resource res) {
- try {
- if (res.getURL().getPath().equals("/"))
- return null;
-
- String urlStr = res.getURL().toString();
- if (urlStr.charAt(urlStr.length() - 1) == '/')
- urlStr = urlStr.substring(0, urlStr.length() - 2);
-
- String parentUrlStr = urlStr.substring(0, urlStr.lastIndexOf('/'));
- return runtimeContext.getResource(parentUrlStr + '/');
- } catch (IOException e) {
- throw new SlcException("Cannot get parent for resource " + res, e);
- }
- }
-