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
|
@ -1 +1 @@
|
||||||
1.1.010425.1748
|
1.1.010425.1753
|
|
@ -17,6 +17,7 @@ void main() async {
|
||||||
ClientPackets.register();
|
ClientPackets.register();
|
||||||
// Set up paths
|
// Set up paths
|
||||||
Settings settings = Settings();
|
Settings settings = Settings();
|
||||||
|
Settings.makeAbsoluteSettingsPath();
|
||||||
await settings.Read();
|
await settings.Read();
|
||||||
|
|
||||||
print(
|
print(
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class Consts {
|
class Consts {
|
||||||
static const VERSION = "1.1.010425.1748";
|
static const VERSION = "1.1.010425.1753";
|
||||||
static const MF_VER_URL =
|
static const MF_VER_URL =
|
||||||
"https://git.zontreck.com/AriasCreations/ConanServerManager/raw/branch/master/MASTER_FILE";
|
"https://git.zontreck.com/AriasCreations/ConanServerManager/raw/branch/master/MASTER_FILE";
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,13 @@ class Settings {
|
||||||
final String Base2FAPath =
|
final String Base2FAPath =
|
||||||
"https://github.com/zontreck/steamcmd-2fa/releases/download/0.2.0/steamcmd-2fa";
|
"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._();
|
Settings._();
|
||||||
static final Settings Instance = Settings._();
|
static final Settings Instance = Settings._();
|
||||||
|
|
||||||
|
@ -105,7 +112,7 @@ class Settings {
|
||||||
Future<void> Read() async {
|
Future<void> Read() async {
|
||||||
if (!server) return;
|
if (!server) return;
|
||||||
try {
|
try {
|
||||||
var tag = await NbtIo.read("settings.dat");
|
var tag = await NbtIo.read(ABSOLUTE_PATH);
|
||||||
|
|
||||||
inst = SettingsEntry.deserialize(tag.get("entry") as CompoundTag);
|
inst = SettingsEntry.deserialize(tag.get("entry") as CompoundTag);
|
||||||
|
|
||||||
|
@ -138,7 +145,7 @@ class Settings {
|
||||||
NbtUtils.writeBoolean(tag, "fts", FTS);
|
NbtUtils.writeBoolean(tag, "fts", FTS);
|
||||||
NbtUtils.writeBoolean(tag, "wine_init", wineInitialized);
|
NbtUtils.writeBoolean(tag, "wine_init", wineInitialized);
|
||||||
|
|
||||||
NbtIo.write("settings.dat", tag);
|
NbtIo.write(ABSOLUTE_PATH, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> Open() async {
|
Future<void> Open() async {
|
||||||
|
|
|
@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
# In Windows, build-name is used as the major, minor, and patch parts
|
# In Windows, build-name is used as the major, minor, and patch parts
|
||||||
# of the product and file versions while build-number is used as the build suffix.
|
# of the product and file versions while build-number is used as the build suffix.
|
||||||
version: 1.1.010425+1748
|
version: 1.1.010425+1753
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.1.4 <4.0.0"
|
sdk: ">=3.1.4 <4.0.0"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue