Skip to content

Commit

Permalink
Fixing some obvious bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
bysse committed Sep 7, 2021
1 parent d113db0 commit 2d1da34
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

allprojects {
group = 'com.tazadum.glsl'
version = '1.4.0'
version = '1.4.1'
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void configure(OptionParser parser) {
shaderIdSpec = parser.accepts("id", "Set the shader id, used for C-header generation.")
.withRequiredArg().describedAs("id");

blacklistSpec = parser.accepts("no-render", "Black lists a keyword that will be omitted from rendering.")
blacklistSpec = parser.accepts("no-render", "Omit a keyword from rendering.")
.withRequiredArg().describedAs("keyword");

indentationSpec = parser.accepts("fidentation", "The number of spaces to use for output indentation")
Expand Down Expand Up @@ -145,7 +145,7 @@ public boolean handle(OptionSet optionSet, Logger logger) {

@Override
public Path generateOutput(Path inputPath) {
String name = inputPath.toFile().getName();
String name = stripExtension(inputPath.toFile().getName());
switch (outputFormat) {
case SHADERTOY:
case PLAIN:
Expand All @@ -157,6 +157,16 @@ public Path generateOutput(Path inputPath) {
}
}

private String stripExtension(String name) {
if (name.endsWith(".glsl")) {
name = name.substring(0, name.length() - 5);
if (name.isEmpty()) {
return "shader";
}
}
return name;
}

private void printFormatExpectations(Logger logger) {
logger.error("Expected one of:");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.io.FileReader;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;

/**
* Created by erikb on 2018-09-28.
Expand Down Expand Up @@ -40,6 +41,10 @@ public String readLine() throws IOException {

@Override
public Source resolve(String filePath) throws FileNotFoundException {
if (path.getParent() == null) {
return new FileSource(Paths.get(filePath));
}

return new FileSource(path.getParent().resolve(filePath));
}

Expand Down

0 comments on commit 2d1da34

Please sign in to comment.