Skip to content

Commit 7932000

Browse files
committed
use true temporary file name
1 parent 5030982 commit 7932000

File tree

1 file changed

+8
-1
lines changed
  • opengrok-indexer/src/main/java/org/opengrok/indexer/util

1 file changed

+8
-1
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/util/CtagsUtil.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,14 @@ public static boolean validate(String ctagsBinary) {
7272
* @return true if at least one symbol was found, false otherwise
7373
*/
7474
private static boolean canProcessFiles(String basePath) {
75-
Path inputPath = Path.of(basePath, "ctagsValidationTemporaryFile.c");
75+
Path inputPath;
76+
try {
77+
inputPath = File.createTempFile("ctagsValidation", ".c",
78+
new File(basePath)).toPath();
79+
} catch (IOException e) {
80+
LOGGER.log(Level.WARNING, "cannot create temporary file in ''{0}''", basePath);
81+
return false;
82+
}
7683
final String resourceFileName = "sample.c";
7784
ClassLoader classLoader = CtagsUtil.class.getClassLoader();
7885
try (InputStream inputStream = classLoader.getResourceAsStream(resourceFileName)) {

0 commit comments

Comments
 (0)