-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor FileSystem handling (fix absolute paths on Windows) #93
base: master
Are you sure you want to change the base?
Conversation
br.close(); | ||
return sb.toString(); | ||
public static String readAllText(File file) throws IOException { | ||
return new String(Files.readAllBytes(file.toPath()), StandardCharsets.UTF_8); // in Java 11 you can also do Files.readString(Path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this is not exactly equivalent to the previous implementation, as \r\n
is not trimmed to \n
.
I think this is preferable when working with binary files. (Unless there's an operator for reading binary files that I missed?)
@@ -66,7 +66,7 @@ | |||
public class Ops { | |||
|
|||
public static final Random RAND = new Random((new Date()).getTime()); | |||
public static final Pattern PATTERN_URL = Pattern.compile("http:\\/\\/.*|https:\\/\\/.*"); | |||
public static final Pattern PATTERN_URL = Pattern.compile("https?://.*"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is kinda off-topic. But I figured it was reasonable enough.
@@ -107,23 +107,7 @@ public static boolean setAyaDir(String dir) { | |||
return false; | |||
} | |||
} | |||
|
|||
public static ArrayList<String> listFilesForWorkingDir() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these methods were unused
I noticed that while
G
works great,.G
does not.Example:
"C:\abs\file.txt" :& G \ "_2"+ 0 .G
(which should copy the file content intoC:\abs\file.txt_2
)instead results in
So I had a look at all the uses of AyaPrefs.getWorkingDir() and updated those.
Tests
:{sys.file_exists}
also behaves as expected.I did not test SaveGraphicsInstruction, Plots and File-Deletion (seems reasonable to assume that these will operate correctly)