Skip to content

Commit

Permalink
Merge pull request #18 from ArkinSolomon/develop
Browse files Browse the repository at this point in the history
Test fix bug that happens when having multiple paths
  • Loading branch information
ArkinSolomon authored Feb 7, 2023
2 parents 0f4b91a + 67429d2 commit a4afab7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Sakura Interpreter -- Java

<img src="https://img.shields.io/badge/Interpreter%20Version-1.1.1-red" /> <img src="https://img.shields.io/badge/Lang Version-0.1.0--beta.4-green" /> [![Tests](https://github.com/ArkinSolomon/sakura-interpreter-java/actions/workflows/test-all.yml/badge.svg)](https://github.com/ArkinSolomon/sakura-interpreter-java/actions/workflows/test-all.yml) [![javadoc](https://javadoc.io/badge2/net.arkinsolomon/sakurainterpreter/javadoc.svg)](https://javadoc.io/doc/net.arkinsolomon/sakurainterpreter) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
<img src="https://img.shields.io/badge/Interpreter%20Version-1.2.0--SNAPSHOT-red" /> <img src="https://img.shields.io/badge/Lang Version-0.1.0--beta.4-green" /> [![Tests](https://github.com/ArkinSolomon/sakura-interpreter-java/actions/workflows/test-all.yml/badge.svg)](https://github.com/ArkinSolomon/sakura-interpreter-java/actions/workflows/test-all.yml) [![javadoc](https://javadoc.io/badge2/net.arkinsolomon/sakurainterpreter/javadoc.svg)](https://javadoc.io/doc/net.arkinsolomon/sakurainterpreter) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

Sakura Interpreter written in Java.

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>net.arkinsolomon</groupId>
<artifactId>sakurainterpreter</artifactId>
<version>1.1.1</version>
<version>1.2.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Sakura Interpreter</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
public class SakuraInterpreter {

public static final String LANG_VERSION = "0.1.0-beta-4";
public static final String INTERPRETER_VERSION = "1.1.1";
public static final String INTERPRETER_VERSION = "1.2.0-SNAPSHOT";

private final InterpreterOptions options;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,20 @@ public boolean isValidWritePath(File file) {
return false;

if (allowWrite.isEmpty() && disallowWrite.isEmpty())
return true;

return false;

boolean canWrite = false;
for (File writeable : allowWrite) {
if (!isWithinDirectory(file, writeable))
return false;
if (isWithinDirectory(file, writeable))
canWrite = true;
}

for (File nonWriteable : disallowWrite) {
if (isWithinDirectory(file, nonWriteable))
return false;
}

return true;
return canWrite;
}

/**
Expand All @@ -121,21 +121,20 @@ public boolean isValidReadPath(File file) {
if (file.exists() && !file.canRead())
return false;


if (allowRead.isEmpty() && disallowRead.isEmpty())
return true;

return false;

boolean canRead = false;
for (File readable : allowRead) {
if (!isWithinDirectory(file, readable))
return false;
if (isWithinDirectory(file, readable))
canRead = true;
}

for (File nonReadable : disallowRead) {
if (isWithinDirectory(file, nonReadable))
return false;
}

return true;
return canRead;
}
}

0 comments on commit a4afab7

Please sign in to comment.