Package de.geolykt.starloader.launcher
Class Utils
java.lang.Object
de.geolykt.starloader.launcher.Utils
Collection of static utility methods.
-
Method Summary
Modifier and TypeMethodDescriptionstatic final @NotNull StringapplyPlaceholders(@NotNull Object sourceResource, @NotNull String string, int startIndex, @NotNull Map<String, String> placeholders) Expand placeholders as defined byExtensionPrototype.getDefinedProperties().static final voidfastExhaust(@NotNull InputStream in) static final PathObtains the directory where SLL puts its logs.static final voidstatic final @Nullable URItoCodeSourceURI(@Nullable URL url, @NotNull String internalClassName)
-
Method Details
-
applyPlaceholders
@NotNull @AvailableSince("4.0.0-a20240711") @Contract(pure=true) public static final @NotNull String applyPlaceholders(@NotNull @NotNull Object sourceResource, @NotNull @NotNull String string, int startIndex, @NotNull @NotNull Map<String, String> placeholders) Expand placeholders as defined byExtensionPrototype.getDefinedProperties(). This method will recursively replace placeholders.- Parameters:
sourceResource- The resource from which the input string comes from, used when logging unknown keys. Logged as-is, so theObject.toString()method of the value passed as this argument should be human-readable.string- The input string which may contain placeholders to expand.startIndex- The index from which the expansion should start from. When calling this method directly, it usually can be set to 0 to replace the entire string.placeholders- The placeholders to apply.- Returns:
- The returned string with all relevant properties being expanded.
- Since:
- 4.0.0-a20240711
-
fastExhaust
- Throws:
IOException
-
getLogDirectory
Obtains the directory where SLL puts its logs.It will first try to set the log directory to the value described by XDG_STATE_HOME, then "%APPDATA%/stianloader", then "${user.home}/.local/state/stianloader" and if it still fails it will put it in the current working directory. It will however only create a single directory in order to accomplish this, so it won't always use the current working directory if less advanced users attempt to use the launcher.
- Returns:
- The directory in which the logs of SLL are stored.
-
startMain
-
toCodeSourceURI
-