Skip to content
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

Added a system property, that enables the zip file cache for larger f… #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/main/java/net/fabricmc/tinyremapper/TinyRemapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,13 @@ private List<RClass> readFile(Path file, Namespace namespace, final Path srcPath
}

if (fs == null) {
fs = FileSystems.newFileSystem(uri, Collections.emptyMap());
Map<String, Object> env = new HashMap<>();
if(System.getProperty("tiny_use_zipcache","FALSE").equals("TRUE")){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do people use lowercase or uppercase for values more often?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better yet, use lowercase and call toLowerCase on the property value. Furthermore, System.getProperty is null if the property isn't present, so this will crash with an NPE if the property isn't specified.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can't do that, because I give a default value to be used when it's not present. I can set it to lowercase.

Although, it's only a partial fix, because it still runs out of memory, but it's no longer because of the zipfs.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My suggestion is to use "tiny.useZipCache"

Also - don't forget Boolean.getBoolean() 😉

env.put("create", "true");
env.put("useTempFile", Boolean.TRUE);
}

fs = FileSystems.newFileSystem(uri, env);
fsToClose.add(fs);
}

Expand Down