Merge branch 'main' into dev-scene

This commit is contained in:
Melledy
2022-04-18 21:35:01 -07:00
parent e8261d568b
commit 057f568a37
21 changed files with 1334 additions and 548 deletions

View File

@@ -79,6 +79,15 @@ public final class Utils {
return v7;
}
/**
* Creates a string with the path to a file.
* @param path The path to the file.
* @return A path using the operating system's file separator.
*/
public static String toFilePath(String path) {
return path.replace("/", File.separator);
}
/**
* Checks if a file exists on the file system.
* @param path The path to the file.
@@ -118,6 +127,16 @@ public final class Utils {
}
}
/**
* Get object with null fallback.
* @param nonNull The object to return if not null.
* @param fallback The object to return if null.
* @return One of the two provided objects.
*/
public static <T> T requireNonNullElseGet(T nonNull, T fallback) {
return nonNull != null ? nonNull : fallback;
}
/**
* Checks for required files and folders before startup.
*/