PaperMC / Paperclip

Bootstrap utility and launcher for the Paper Minecraft server
MIT License
120 stars 51 forks source link

use system cache directory for cache #53

Closed jamespglines closed 2 years ago

jamespglines commented 2 years ago

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.

electronicboy commented 2 years ago

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

jamespglines commented 2 years ago

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
electronicboy commented 2 years ago

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

MiniDigger commented 2 years ago

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.

DenWav commented 2 years ago

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