Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions src/main/java/com/mytaxi/apis/phrase/tasks/FileService.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,6 @@ class FileService
private static final String PROJECT_ID_PLACEHOLDER = "{projectid}";
private static final String BRANCH_PLACEHOLDER = "{branch}";


FileService()
{
try
{
generatedResourcesFoldername = new ClassPathResource("/").getFile().getPath();
}
catch (final Exception e)
{
LOG.error("could not get default ClassPathResource. use /generated-resources/ instead");
}
}


public void saveToFile(final String projectId, final byte[] translationByteArray, final String locale) throws IOException
{
saveToFile(projectId, MASTER_BRANCH, translationByteArray, locale);
Expand Down Expand Up @@ -82,7 +68,7 @@ public void saveToFile(final String projectId, String branch, final byte[] trans

private void initMessageDirectory() throws IOException
{
messagesDirectory = Paths.get(firstNonNull(generatedResourcesFoldername, GENERATED_RESOURCES_FOLDERNAME));
messagesDirectory = Paths.get(firstNonNull(getGeneratedResourcesFoldername(), GENERATED_RESOURCES_FOLDERNAME));
Files.createDirectories(messagesDirectory);
}

Expand Down Expand Up @@ -152,6 +138,18 @@ public void setMessageFilePrefix(final String messageFilePrefix)

public String getGeneratedResourcesFoldername()
{
if (generatedResourcesFoldername == null)
{
try
{
generatedResourcesFoldername = new ClassPathResource("/").getFile().getPath();
}
catch (final Exception e)
{
LOG.error("could not get default ClassPathResource. use /generated-resources/ instead");
}
}

return generatedResourcesFoldername;
}

Expand Down