serverwatcher 3.1.4__tar.gz → 3.1.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: serverwatcher
3
- Version: 3.1.4
3
+ Version: 3.1.5
4
4
  Summary: A HungerLib-powered Minecraft server automation engine.
5
5
  Author: iFamished
6
6
  License: MIT
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
7
7
 
8
8
  [project]
9
9
  name = "serverwatcher"
10
- version = "3.1.4"
10
+ version = "3.1.5"
11
11
  description = "A HungerLib-powered Minecraft server automation engine."
12
12
  readme = "README.md"
13
13
  requires-python = ">=3.10"
@@ -20,6 +20,8 @@ from serverwatcher.config.global_config import GlobalConfig
20
20
  from serverwatcher.config.messages import MessagesConfig
21
21
  from serverwatcher.config.watcher import WatcherConfig
22
22
 
23
+ # BASE DIRECTORY OF THIS PACKAGE
24
+ BASE_DIR = os.path.dirname(__file__)
23
25
 
24
26
  # ---------------------------------------------------------
25
27
  # Utility: load config or copy default from defaultconfigs/
@@ -29,12 +31,16 @@ def load_or_default(path: str, default_path: str, schema):
29
31
  Loads YAML from path. If missing, copies default_path → path.
30
32
  Then maps YAML → dataclass.
31
33
  """
32
- if not os.path.exists(path):
33
- os.makedirs(os.path.dirname(path), exist_ok=True)
34
- with open(default_path, "r") as src, open(path, "w") as dst:
34
+
35
+ abs_path = os.path.join(BASE_DIR, path)
36
+ abs_default = os.path.join(BASE_DIR, default_path)
37
+
38
+ if not os.path.exists(abs_path):
39
+ os.makedirs(os.path.dirname(abs_path), exist_ok=True)
40
+ with open(abs_default, "r") as src, open(abs_path, "w") as dst:
35
41
  dst.write(src.read())
36
42
 
37
- raw = load_yaml(path)
43
+ raw = load_yaml(abs_path)
38
44
  return map_to_dataclass(raw, schema)
39
45
 
40
46
 
@@ -46,19 +52,19 @@ class ServerWatcher:
46
52
  # Load all 3 configs
47
53
  self.global_cfg: GlobalConfig = load_or_default(
48
54
  "config/global.yaml",
49
- "serverwatcher/defaultconfigs/global.yaml",
55
+ "defaultconfigs/global.yaml",
50
56
  GlobalConfig
51
57
  )
52
58
 
53
59
  self.messages: MessagesConfig = load_or_default(
54
60
  "config/messages.yaml",
55
- "serverwatcher/defaultconfigs/messages.yaml",
61
+ "defaultconfigs/messages.yaml",
56
62
  MessagesConfig
57
63
  )
58
64
 
59
65
  self.cfg: WatcherConfig = load_or_default(
60
66
  "config/watcher.yaml",
61
- "serverwatcher/defaultconfigs/watcher.yaml",
67
+ "defaultconfigs/watcher.yaml",
62
68
  WatcherConfig
63
69
  )
64
70
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: serverwatcher
3
- Version: 3.1.4
3
+ Version: 3.1.5
4
4
  Summary: A HungerLib-powered Minecraft server automation engine.
5
5
  Author: iFamished
6
6
  License: MIT
File without changes
File without changes
File without changes