Fix formatting and add missing braces in Repository#stripWorkDir
Change-Id: I601d917f3741e0207a8ee7a365d9c2dea6422401 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
400bfd6665
commit
a52b331d71
|
@ -1536,10 +1536,11 @@ public static String stripWorkDir(File workDir, File file) {
|
||||||
final String filePath = file.getPath();
|
final String filePath = file.getPath();
|
||||||
final String workDirPath = workDir.getPath();
|
final String workDirPath = workDir.getPath();
|
||||||
|
|
||||||
if (filePath.length() <= workDirPath.length() ||
|
if (filePath.length() <= workDirPath.length()
|
||||||
filePath.charAt(workDirPath.length()) != File.separatorChar ||
|
|| filePath.charAt(workDirPath.length()) != File.separatorChar
|
||||||
!filePath.startsWith(workDirPath)) {
|
|| !filePath.startsWith(workDirPath)) {
|
||||||
File absWd = workDir.isAbsolute() ? workDir : workDir.getAbsoluteFile();
|
File absWd = workDir.isAbsolute() ? workDir
|
||||||
|
: workDir.getAbsoluteFile();
|
||||||
File absFile = file.isAbsolute() ? file : file.getAbsoluteFile();
|
File absFile = file.isAbsolute() ? file : file.getAbsoluteFile();
|
||||||
if (absWd.equals(workDir) && absFile.equals(file)) {
|
if (absWd.equals(workDir) && absFile.equals(file)) {
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
|
@ -1548,8 +1549,9 @@ public static String stripWorkDir(File workDir, File file) {
|
||||||
}
|
}
|
||||||
|
|
||||||
String relName = filePath.substring(workDirPath.length() + 1);
|
String relName = filePath.substring(workDirPath.length() + 1);
|
||||||
if (File.separatorChar != '/')
|
if (File.separatorChar != '/') {
|
||||||
relName = relName.replace(File.separatorChar, '/');
|
relName = relName.replace(File.separatorChar, '/');
|
||||||
|
}
|
||||||
return relName;
|
return relName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue