Fix some null check errors

This commit is contained in:
zontreck 2023-11-04 01:37:37 -07:00
parent d03613b0c7
commit fc9dc6f4d3
5 changed files with 26 additions and 32 deletions

View file

@ -10,6 +10,9 @@ class Settings {
Settings._();
static final Settings Instance = Settings._();
String steamcmd_path = "";
String game_path = "";
factory Settings() {
return Instance;
}
@ -38,7 +41,7 @@ class Settings {
Future<Box<E>> Open<E>() {
Close();
return Hive.openBox("settings", path: inst!.game_path);
return Hive.openBox("settings", path: game_path);
}
static void Close() {
@ -48,33 +51,32 @@ class Settings {
}
String getServerPath() {
return inst!.game_path + Platform.pathSeparator + "server";
return game_path + Platform.pathSeparator + "server";
}
bool checkInitDone() {
if (File(inst!.steamcmd_path + Platform.pathSeparator + "cxinit")
.existsSync()) {
if (File(steamcmd_path + Platform.pathSeparator + "cxinit").existsSync()) {
return true;
} else
return false;
}
String getSteamCmd() {
return inst!.steamcmd_path +
return steamcmd_path +
Platform.pathSeparator +
"steamcmd" +
(Platform.isWindows ? ".exe" : ".sh");
}
String getSteamCmd2FA() {
return inst!.steamcmd_path +
return steamcmd_path +
Platform.pathSeparator +
"steamcmd-2fa" +
(Platform.isWindows ? ".exe" : "");
}
String getModPath() {
return inst!.game_path + Platform.pathSeparator + "mods";
return game_path + Platform.pathSeparator + "mods";
}
Future<void> createModFolderIfNotExists() async {