Files
OpenPrestige/src/main/java/dev/zprestige/prestige/client/AppPaths.java
T
bbldrizzy 2d6b2a3cd1 Build offline OpenPrestige release bundles
Rename the injector and package it with an embedded payload for Windows, Linux, and macOS x64/ARM64. Add a core-only ImGui native build, multi-platform CI and release packaging, and shared per-user storage with legacy config migration.
2026-11-03 18:45:13 +00:00

43 lines
1.3 KiB
Java

package dev.zprestige.prestige.client;
import java.nio.file.Path;
public final class AppPaths {
private static final Path ROOT = root();
private AppPaths() {}
public static Path configs() {
return ROOT.resolve("configs");
}
public static Path runtime() {
return ROOT.resolve("runtime");
}
private static Path root() {
String os = System.getProperty("os.name", "");
Path base;
if (os.startsWith("Windows")) {
base = env("APPDATA");
Path home = env("USERPROFILE");
if (base == null && home != null) base = home.resolve("AppData").resolve("Roaming");
} else {
Path home = env("HOME");
if (os.startsWith("Mac")) {
base = home == null ? null : home.resolve("Library").resolve("Application Support");
} else {
base = env("XDG_DATA_HOME");
if (base == null || !base.isAbsolute()) base = home == null ? null : home.resolve(".local").resolve("share");
}
}
if (base == null) base = Path.of(System.getProperty("java.io.tmpdir"));
return base.resolve(".openprestige");
}
private static Path env(String name) {
String value = System.getenv(name);
return value == null || value.isEmpty() ? null : Path.of(value);
}
}