in aws-core-agent/src/main/java/jetbrains/buildServer/clouds/amazon/connector/AwsCredentialsHandler.java [119:147]
private File createFileInTempDirectory(@NotNull AgentBuildSettings build) throws IOException {
//NOTE: Agent temp will be cleaned by one of build stages.
//NOTE: All we need here is to generate some name for a file that will be
//NOTE: created later in the SaveProperties to Files build stage
try {
//This directory may not exist.
final File tempDirectory = build.getAgentTempDirectory();
//We need directory to create temp file name
tempDirectory.mkdirs();
File file = new File(tempDirectory, AWS_CREDENTIALS_FILE_NAME);
if (file.isFile()) {
FileUtil.delete(file);
}
if (!file.createNewFile()) {
throw new IOException("Can't create file: " + file.getAbsolutePath());
}
return FileUtil.getCanonicalFile(file);
} catch (final IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOException(e.getMessage()) {{
initCause(e);
}};
}
}