From 64a06e7dbcec2c9e0bf49c568136379a565c2570 Mon Sep 17 00:00:00 2001 From: Etienne Lamoureux <3357406+EtienneLamoureux@users.noreply.github.com> Date: Wed, 29 Nov 2023 20:42:40 -0500 Subject: [PATCH] Fix access denied and SSL issues (#24) --- CHANGELOG.md | 5 +++++ build.gradle | 6 +++--- .../companion/output/commodity/CommodityCsvWriter.java | 2 -- src/main/java/tools/sctrade/companion/utils/CsvUtil.java | 5 ++++- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee1e82f..32381d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ # SC Trade Companion +## 0.2.1 +### Bugs +- Fix data not being exported to the /my-data folder +- Fix data not being published to https://sc-trade.tools + ## 0.2.0 ### Features - #8 Add a sound when a screenshot is taken diff --git a/build.gradle b/build.gradle index 88fe817..bb15907 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { } group = 'tools.sctrade' -version = '0.2.0' +version = '0.2.1' java { sourceCompatibility = '17' @@ -67,7 +67,7 @@ task jdeps(dependsOn: 'copyDependencies') { doLast { exec { def jdeps = new ByteArrayOutputStream() - commandLine 'jdeps', '--class-path', '"build/dependencies/*"', '--multi-release', 'base', '--ignore-missing-deps', '-recursive', '--print-module-deps', "$buildDir/libs/${rootProject.name}-${version}.jar" + commandLine 'jdeps', '--class-path', '"build/dependencies/*"', '--multi-release', 'base', '--ignore-missing-deps', '-recursive', '--print-module-deps', "$buildDir/libs/${rootProject.name}-${version}.jar" // TODO append jdk.crypto.ec standardOutput = jdeps ext.jdeps = jdeps } @@ -78,7 +78,7 @@ task jlink(dependsOn: 'jdeps') { doLast { exec { workingDir = projectDir - commandLine 'jlink', '--output', "$binariesDir/jre", '--add-modules', 'java.base,java.compiler,java.desktop,java.instrument,java.management,java.naming,java.net.http,java.prefs,java.scripting,java.sql,jdk.jfr,jdk.unsupported' // TODO use "${tasks.jdeps.jdeps}" + commandLine 'jlink', '--output', "$binariesDir/jre", '--add-modules', 'java.base,java.compiler,java.desktop,java.instrument,java.management,java.naming,java.net.http,java.prefs,java.scripting,java.sql,jdk.jfr,jdk.unsupported,jdk.crypto.ec' // TODO use "${tasks.jdeps.jdeps}" } } } diff --git a/src/main/java/tools/sctrade/companion/output/commodity/CommodityCsvWriter.java b/src/main/java/tools/sctrade/companion/output/commodity/CommodityCsvWriter.java index 8964ae5..b52a98b 100644 --- a/src/main/java/tools/sctrade/companion/output/commodity/CommodityCsvWriter.java +++ b/src/main/java/tools/sctrade/companion/output/commodity/CommodityCsvWriter.java @@ -1,6 +1,5 @@ package tools.sctrade.companion.output.commodity; -import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; @@ -35,7 +34,6 @@ public void process(CommoditySubmission submission) { try { logger.debug("Writing {} commodity listings to '{}'...", submission.getListings().size(), filePath); - Files.createDirectories(filePath); Collection> lines = buildLines(submission); CsvUtil.write(filePath, lines); logger.info("Wrote {} commodity listings to '{}'", submission.getListings().size(), filePath); diff --git a/src/main/java/tools/sctrade/companion/utils/CsvUtil.java b/src/main/java/tools/sctrade/companion/utils/CsvUtil.java index 084721e..bf1977a 100644 --- a/src/main/java/tools/sctrade/companion/utils/CsvUtil.java +++ b/src/main/java/tools/sctrade/companion/utils/CsvUtil.java @@ -9,6 +9,7 @@ import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; +import java.nio.file.Files; import java.nio.file.Path; import java.util.Arrays; import java.util.Collection; @@ -24,7 +25,9 @@ public class CsvUtil { private CsvUtil() {} - public static void write(Path path, Collection> lines) { + public static void write(Path path, Collection> lines) throws IOException { + Files.createDirectories(path.getParent()); + try (CSVWriter writer = new CSVWriter(new FileWriter(path.toString(), true))) { for (List line : lines) { writer.writeNext(line.toArray(new String[0]));