The list of methods to do Root Path Get are organized into topic(s).
String
getRootFolder(final File file, final String headerFileName) get Root Folder
final ZipFile productZip = new ZipFile(file, ZipFile.OPEN_READ);
final Optional result = productZip.stream().filter(ze -> !ze.isDirectory())
.filter(ze -> ze.getName().toLowerCase().endsWith(headerFileName)).findFirst();
ZipEntry ze = (ZipEntry) result.get();
String path = ze.toString();
int sepIndex = path.lastIndexOf('/');
if (sepIndex > 0) {
return path.substring(0, sepIndex) + '/';
...
String
getRootFolderPath(File file) Get Path from the update root Folder.
String absolutePath = file.getAbsolutePath();
return absolutePath.substring(absolutePath.indexOf("update"), absolutePath.length());
String
getRootName(File f) get Root Name
String fnm = f.getName();
int index = fnm.lastIndexOf(".");
return fnm.substring(0, index == -1 ? fnm.length() : index);
String
getRootName(String fnm) get Root Name
int ild = fnm.lastIndexOf(".");
String root = fnm;
if (ild > 0) {
root = fnm.substring(0, fnm.lastIndexOf("."));
return root;
String
getRootName(String pathname) Returns the whole 'pathname' without the extension ('.'
String name = new java.io.File(pathname).getName();
int i = name.lastIndexOf('.');
return (i < 0) ? pathname : pathname.substring(0, pathname.length() + i - name.length());
String
getRootPath() get Root Path
return File.listRoots()[0].getAbsolutePath();
String
getRootPath() get Root Path
File file = new File(System.getProperty("user.dir"));
String path = file.getAbsolutePath().replace('\\', '/');
path = path.substring(0, path.indexOf('/'));
return path;
File
getRootPath(String testDir) get Root Path
File baseDir = new File(System.getProperty("basedir", "restatic-core"));
File rootPath = new File(baseDir, testDir);
return rootPath;