Skip to content

Commit

Permalink
Small fix to jar creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Chrisvenator committed Aug 13, 2024
1 parent 35b4a19 commit 7be6fd3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ libs/*
/database/.idea/dataSources.xml
/database/.idea/modules.xml
/database/.idea/vcs.xml
/src/main/resources/All_Maps_Merged.json
/All_Maps_Merged.json
/OnsetGeneration/mp3Files/
/database/exported_schema.sql
config.json
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/DataManager/CreateAllNecessaryDIRsAndFiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
public class CreateAllNecessaryDIRsAndFiles {
public static final Set<String> foldersToCopyOutOfJar = Set.of(
"OnsetGeneration",
"README",
"README.md",
"Patterns",
"dev",
"assets"
Expand All @@ -35,7 +35,7 @@ public static void createAllNecessaryDIRsAndFiles() {
System.out.println("Creating all necessary directories and files.");

createConfig();
if (DEFAULT_PATH.contains("Steam")) throw new RuntimeException("Hier ist der Fehler: " + DEFAULT_PATH);
// if (DEFAULT_PATH.contains("Steam")) throw new RuntimeException("Hier ist der Fehler: " + DEFAULT_PATH);

try {
extractSpecificFolders("./", foldersToCopyOutOfJar);
Expand All @@ -48,7 +48,7 @@ public static void createAllNecessaryDIRsAndFiles() {

public static void extractSpecificFolders(String destDir, Set<String> foldersToExtract) throws IOException {
// Get the path of the running JAR file
String jarPath = new File(CreateAllNecessaryDIRsAndFiles.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getAbsolutePath();
String jarPath = new File(CreateAllNecessaryDIRsAndFiles.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getAbsolutePath().replaceAll("%20", " ");

// Open the JAR file as a stream
try (JarInputStream jarInputStream = new JarInputStream(Files.newInputStream(Paths.get(jarPath)))) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/Start.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static void main(String[] args) throws NoteNotValidException {
logger.info("Seed: {}", SEED);
logger.info("Setting Hibernate Logger to warning");

if (executedByJar && !new File("./congi.json").exists()) {
if (executedByJar && !new File("./config.json").exists()) {
logger.info("Found that the program is executed by a jar file.");
CreateAllNecessaryDIRsAndFiles.createAllNecessaryDIRsAndFiles();
}
Expand Down

0 comments on commit 7be6fd3

Please sign in to comment.