Skip to content

Commit

Permalink
Add platform-independent directory separator, add file output logs
Browse files Browse the repository at this point in the history
  • Loading branch information
CherryPill committed Feb 3, 2020
1 parent 3b4f88d commit 1e4742f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/application/converter/Converter.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class Converter<V> extends Task<V> {

private static final Logger logger = LogManager.getLogger(Converter.class);
public Converter(List<File> inputFiles,
File outputDir,
Converter.UI_OUTFILE_CONVERSION_TYPE conversionType,
Expand Down Expand Up @@ -109,7 +111,7 @@ private void convertAllImages() {
//convert -> convertSingleImage
public void convertSingleImage(File inputFile, String outFileName) {
String format = Utility.inferExtension(inputFile.getName());
File modifiedOutPath = new File(outputDir.getAbsolutePath() + "\\" + outFileName);
File modifiedOutPath = new File(outputDir.getAbsolutePath() + File.separator + outFileName);
GifEncoder ge = null;
ImageInputStream stream = null;
ImageOutputStream outStream = null;
Expand Down Expand Up @@ -223,6 +225,7 @@ public void convertSingleImage(File inputFile, String outFileName) {
ge.write(outImage);

} else {
logger.info("Output file location: " + modifiedOutPath.toString());
ImageIO.write(outImage, Utility.inferExtension(modifiedOutPath.getAbsolutePath()), modifiedOutPath);
}
}
Expand Down

0 comments on commit 1e4742f

Please sign in to comment.