Make settings read and write operations use the absolute path instead of relative path
This commit is contained in:
parent
317df007d4
commit
f5acee7b56
5 changed files with 13 additions and 5 deletions
|
@ -25,6 +25,13 @@ class Settings {
|
|||
final String Base2FAPath =
|
||||
"https://github.com/zontreck/steamcmd-2fa/releases/download/0.2.0/steamcmd-2fa";
|
||||
|
||||
static String ABSOLUTE_PATH = "";
|
||||
|
||||
static void makeAbsoluteSettingsPath() {
|
||||
File fi = File("settings.dat");
|
||||
ABSOLUTE_PATH = fi.absolute.path;
|
||||
}
|
||||
|
||||
Settings._();
|
||||
static final Settings Instance = Settings._();
|
||||
|
||||
|
@ -105,7 +112,7 @@ class Settings {
|
|||
Future<void> Read() async {
|
||||
if (!server) return;
|
||||
try {
|
||||
var tag = await NbtIo.read("settings.dat");
|
||||
var tag = await NbtIo.read(ABSOLUTE_PATH);
|
||||
|
||||
inst = SettingsEntry.deserialize(tag.get("entry") as CompoundTag);
|
||||
|
||||
|
@ -138,7 +145,7 @@ class Settings {
|
|||
NbtUtils.writeBoolean(tag, "fts", FTS);
|
||||
NbtUtils.writeBoolean(tag, "wine_init", wineInitialized);
|
||||
|
||||
NbtIo.write("settings.dat", tag);
|
||||
NbtIo.write(ABSOLUTE_PATH, tag);
|
||||
}
|
||||
|
||||
Future<void> Open() async {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue