Skip to content

Commit cad638c

Browse files
author
Vladimir Kotal
committed
fix path generation
1 parent d4148bf commit cad638c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/history/SCCSRepository.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.io.FileReader;
2929
import java.io.IOException;
3030
import java.io.InputStream;
31+
import java.nio.file.Paths;
3132
import java.util.ArrayList;
3233
import java.util.HashMap;
3334
import java.util.Map;
@@ -56,6 +57,8 @@ public class SCCSRepository extends Repository {
5657
*/
5758
public static final String CMD_FALLBACK = "sccs";
5859

60+
private static final String CODEMGR_WSDATA = "Codemgr_wsdata";
61+
5962
public SCCSRepository() {
6063
type = "SCCS";
6164
datePatterns = new String[]{
@@ -143,18 +146,18 @@ public void update() {
143146
public boolean fileHasHistory(File file) {
144147
String parentFile = file.getParent();
145148
String name = file.getName();
146-
File f = new File(parentFile + "/SCCS/s." + name);
149+
File f = Paths.get(parentFile, "SCCS", "s." + name).toFile();
147150
return f.exists();
148151
}
149152

150153
@Override
151154
boolean isRepositoryFor(File file, boolean interactive) {
152155
if (file.isDirectory()) {
153-
File f = new File(file, "codemgr_wsdata");
156+
File f = new File(file, CODEMGR_WSDATA.toLowerCase());
154157
if (f.isDirectory()) {
155158
return true;
156159
}
157-
f = new File(file, "Codemgr_wsdata");
160+
f = new File(file, CODEMGR_WSDATA);
158161
if (f.isDirectory()) {
159162
return true;
160163
}
@@ -187,8 +190,7 @@ History getHistory(File file) throws HistoryException {
187190

188191
@Override
189192
String determineParent(boolean interactive) throws IOException {
190-
File parentFile = new File(getDirectoryName() + File.separator
191-
+ "Codemgr_wsdata" + File.separator + "parent");
193+
File parentFile = Paths.get(getDirectoryName(), CODEMGR_WSDATA, "parent").toFile();
192194
String parent = null;
193195

194196
if (parentFile.isFile()) {

0 commit comments

Comments
 (0)