Skip to content

Commit ed95b30

Browse files
committed
Fix for fileutils list files
1 parent 799dd74 commit ed95b30

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

graphics-by-opengl-j2se/src/main/java/com/nucleus/common/FileUtils.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public ArrayList<String> listResourceFolders(String path) throws IOException, UR
102102
/**
103103
* List the files, based on mime, beginning at path and including the specified folders.
104104
*
105-
* @param path Base path to start file list
105+
* @param path Base path to start file list - shall end with '/'
106106
* @param folders Folders to include in search
107107
* @param mimes File extensions to include
108108
* @return Matching files
@@ -120,6 +120,13 @@ public ArrayList<String> listFiles(String path, ArrayList<String> folders, final
120120
.collect(Collectors.toList());
121121
String listStr = listPath.toString().replace('\\', FileUtils.DIRECTORY_SEPARATOR);
122122
int len = listStr.length();
123+
if (path.endsWith("/")) {
124+
if (!listStr.endsWith("/")) {
125+
listStr = listStr + "/";
126+
}
127+
} else if (listStr.endsWith("/")) {
128+
path = path + "/";
129+
}
123130
int relative = listStr.indexOf(path) + path.length();
124131
if (relative < path.length()) {
125132
throw new IllegalArgumentException("Could not find '" + path + "' in: " + listStr);

graphics-by-opengl-j2se/src/main/java/com/nucleus/vulkan/GLSLCompiler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public void compileStage(String path, ArrayList<String> folders, ByteBuffer buff
9494
file.getPath().indexOf(folder.length() > 0 ? folder + "\\" + file.getName() : file.getName()));
9595
name = filename.substring(0, filename.length() - (stage.name().length() + 1));
9696
output = name + "_" + stage.name() + ".spv";
97-
String cmd = "glslc " + filename + " -o - & echo " + SpirvBinary.SPIRV_END_MARKER;
97+
String cmd = "glslc " + filename + " -o - && echo " + SpirvBinary.SPIRV_END_MARKER;
9898
buffer.clear();
9999
SpirvBinary binary = compile(new String[] { "cd " + filePath, cmd }, null, buffer);
100100
if (binary == null) {

0 commit comments

Comments
 (0)