Revision 10428
Added by Jing Tao about 7 years ago
src/edu/ucsb/nceas/metacat/util/SystemUtil.java | ||
---|---|---|
585 | 585 |
logMetacat.debug("realPath: " + realPath); |
586 | 586 |
logMetacat.debug("contextPath: " + contextPath); |
587 | 587 |
|
588 |
Pattern pattern = Pattern.compile(contextPath + "/\\.$"); |
|
588 |
/*Pattern pattern = Pattern.compile(contextPath + "/\\.$");
|
|
589 | 589 |
Matcher matcher = pattern.matcher(realPath); |
590 | 590 |
|
591 | 591 |
if (matcher.find()) { |
592 | 592 |
realPath = matcher.replaceFirst(""); |
593 |
} |
|
594 |
|
|
593 |
}*/ |
|
594 |
int index = realPath.lastIndexOf(contextPath); |
|
595 |
if(index != -1) { |
|
596 |
realPath = realPath.substring(0,index); |
|
597 |
if(realPath.equals("")) { |
|
598 |
//if the realPath is "/metacat". |
|
599 |
realPath="/"; |
|
600 |
} |
|
601 |
} |
|
602 |
logMetacat.info("SystemUtil.discoverDeployDir: the deploy dir is " + realPath); |
|
595 | 603 |
return realPath; |
596 | 604 |
} |
597 | 605 |
|
Also available in: Unified diff
For ticket https://projects.ecoinformatics.org/ecoinfo/issues/7214.
Use the lastindexof and substring methods to find the deployment directory.