Paperclip icon indicating copy to clipboard operation
Paperclip copied to clipboard

use system cache directory for cache

Open jamespglines opened this issue 2 years ago • 4 comments

Rational

There is conversation in paper-help discord channels that make me this idea. This has two reasons for me creating this merge request:

  1. If you have multiple installations of paper on one computer, you have many copies of the same thing. each new installation on same computer will need to download Mojang jar again and patch all. Because all jars are versioned, this creates no issue for multiple servers of different versions.
  2. All of the directories (it makes 3: cache, libraries, versions) can be confusing to some players.

Implementation

dev.dirs directories-jvm handle all the os specific possible issues with this. I add requireNonNullElse just in the case. especially for windows with some player running supposed debloater script this may return null.

Alternative

If this is not accepted for some reason, maybe move all to .paperclip (or other name. this is my first idea) directory in server folder? This solves numero 2 above.

jamespglines avatar May 07 '22 01:05 jamespglines

storing all this stuff in one system folder has some caveats,

  1. the patched server jar is NOT versioned
  2. file locking is a heartless beach

electronicboy avatar May 07 '22 01:05 electronicboy

I may have misunderstanding but everything looks versioned. I have removed some from libraries for concise

├── cache
│   └── mojang_1.18.2.jar
├── libraries
│   ├── com
│   │   ├── github
│   │   │   └── oshi
│   │   │       └── oshi-core
│   │   │           └── 5.8.5
│   │   │               └── oshi-core-5.8.5.jar
│   |   └── yaml
│   |       └── snakeyaml
│   |           └── 1.30
│   |               └── snakeyaml-1.30.jar
└── versions
    └── 1.18.2
        └── paper-1.18.2.jar

jamespglines avatar May 07 '22 01:05 jamespglines

There are just shy of 100 different versions of that paper-1.18.2.jar

electronicboy avatar May 07 '22 01:05 electronicboy

not sure I like this. there are the issues cat pointed out, plus we already allow you to change it if you are concerned about file size or startup speed or whatever. I generally like how self contained everything is right now and don't think paper should touch files outside the server folder.

I can understand wanting to declutter the server folder, so changing the default to paperclip could make sense, but libraries (and I think versions too?) is a mojang folder, so moving them could add confusion too. cache we had since basically forever, so it shouldn't cause confusion either.

MiniDigger avatar May 07 '22 18:05 MiniDigger

This also adds a dependency to Paperclip which is a big no-no unless absolutely required (e.g. jbsdiff).

DenWav avatar Sep 30 '22 20:09 DenWav