我有一个代码片段可以像这样获取 felix home 的路径:
String path = System.getProperty('felix.home')
Felix 的家在:
D:\LongFolderName\Implementations\brannches\MoreLongFolerName\
路径将是这样的字符串:
D:\LONG-F~1\IMPLEM~1\branches\MORE~1\
我希望它必须是没有“~”字符的完整路径,例如:
D:\LongFolderName\Implementations\brannches\MoreLongFolerName\
我必须做什么?
最佳答案
尝试:
// Groovy
String path = new File( System.properties.'felix.home' ).canonicalPath
或
// Java
String path = new File( System.getProperty('felix.home') ).getCanonicalPath()
关于java - 获取没有 '~' 字符的路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18709608/