Skip to content

Commit

Permalink
SoundInfo: Update Hexen 2 sound info generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Lemon-King committed Oct 16, 2023
1 parent a7eebba commit 4e6573b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 24 deletions.
43 changes: 23 additions & 20 deletions src/main/java/lemon/hxdd/builder/SoundInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,31 +39,34 @@ public void Export() {
private void ListFiles(PrintWriter out) {
String path = this.app.settings.GetPath("hexen2") + "/sound";
File directory = new File(path);
System.out.println(directory.getPath());

File[] fileList = directory.listFiles();
if (fileList != null) {
for (File file : fileList) {
if (file.isFile()) {
try {
String p = file.getCanonicalPath();
p = p.replace("\\", "/");
File[] folderList = directory.listFiles();
if (folderList != null) {
for (File file : folderList) {
if (file.isDirectory()) {
File[] subFolderLIst = file.listFiles();
for (File sfile : subFolderLIst) {
if (sfile.isFile()) {
try {
String p = sfile.getCanonicalPath();
p = p.replace("\\", "/");

String[] s = p.split("hexen2_data");
String logicalname = (String) s[1].subSequence(1, s[1].length() - 4);
String lumpname = (String) s[1].subSequence(1, s[1].length());
String[] s = p.split("hexen2_data");
String logicalname = (String) s[1].subSequence(1, s[1].length() - 4);
String lumpname = (String) s[1].subSequence(1, s[1].length());

// Setup naming convention and folder paths
logicalname = logicalname.replace("sound", "hexen2");
lumpname = lumpname.replace("sound", "sounds/hexen2");

String space = String.join("", Collections.nCopies(32 - logicalname.length(), " ")); // dumb, but it works
out.println(logicalname + space + "\"" + lumpname + "\"");
} catch (IOException ignored) {
// Setup naming convention and folder paths
logicalname = logicalname.replace("sound", "hexen2");
lumpname = lumpname.replace("sound", "sounds/hexen2");

String space = String.join("", Collections.nCopies(32 - logicalname.length(), " ")); // dumb, but it works
out.println(logicalname + space + "\"" + lumpname + "\"");
} catch (IOException e) {
System.out.println(e);
}
}
}
} else if (file.isDirectory()) {
out.println("");
//ListFiles(file.getAbsolutePath(), out);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/lemon/hxdd/shared/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ public static void CopyDirectory(Path source, Path target) throws IOException {
if (Files.isDirectory(source)) {
if (Files.notExists(target)) {
Files.createDirectories(target);
System.out.println("Directory created : " + target);
//System.out.println("Directory created : " + target);
}
try (Stream<Path> paths = Files.list(source)) {
paths.forEach(p -> CopyDirectoryWrapper(p, target.resolve(source.relativize(p))));

}
} else {
Files.copy(source, target, StandardCopyOption.REPLACE_EXISTING);
System.out.println(
String.format("Copy File from \t'%s' to \t'%s'", source, target)
);
//System.out.println(
// String.format("Copy File from \t'%s' to \t'%s'", source, target)
//);
}
}

Expand Down

0 comments on commit 4e6573b

Please sign in to comment.