if (StringUtils.trimToNull(relativeTo) == null) {
return path;
}
URL baseUrl = toClassLoader().getResource(relativeTo);
if (baseUrl == null) {
throw new UnexpectedLiquibaseException("Cannot find base path '"+relativeTo+"'");
}
String base;
if (baseUrl.toExternalForm().startsWith("file:")) {
File baseFile = new File(baseUrl.getPath());
if (!baseFile.exists()) {
throw new UnexpectedLiquibaseException("Base file '"+baseFile.getAbsolutePath()+"' does not exist");
}
if (baseFile.isFile()) {
baseFile = baseFile.getParentFile();
}
base = baseFile.toURI().getPath();