devdash-mac 0.1.1__tar.gz → 0.1.2__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.
Files changed (39) hide show
  1. {devdash_mac-0.1.1/src/devdash_mac.egg-info → devdash_mac-0.1.2}/PKG-INFO +1 -1
  2. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/pyproject.toml +1 -1
  3. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash/__init__.py +1 -1
  4. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash/config.py +30 -10
  5. {devdash_mac-0.1.1 → devdash_mac-0.1.2/src/devdash_mac.egg-info}/PKG-INFO +1 -1
  6. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/LICENSE +0 -0
  7. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/README.md +0 -0
  8. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/setup.cfg +0 -0
  9. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash/__main__.py +0 -0
  10. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash/app.py +0 -0
  11. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash/clipboard.py +0 -0
  12. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash/plugin_loader.py +0 -0
  13. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash/storage.py +0 -0
  14. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash/tools/__init__.py +0 -0
  15. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash/tools/base.py +0 -0
  16. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash/tools/base64_tool.py +0 -0
  17. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash/tools/color_tool.py +0 -0
  18. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash/tools/cron_tool.py +0 -0
  19. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash/tools/hash_tool.py +0 -0
  20. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash/tools/json_tool.py +0 -0
  21. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash/tools/jwt_tool.py +0 -0
  22. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash/tools/lorem_tool.py +0 -0
  23. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash/tools/password_tool.py +0 -0
  24. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash/tools/regex_tool.py +0 -0
  25. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash/tools/timestamp_tool.py +0 -0
  26. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash/tools/url_tool.py +0 -0
  27. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash/tools/uuid_tool.py +0 -0
  28. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash/ui/__init__.py +0 -0
  29. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash/ui/notifications.py +0 -0
  30. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash/ui/windows.py +0 -0
  31. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash_mac.egg-info/SOURCES.txt +0 -0
  32. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash_mac.egg-info/dependency_links.txt +0 -0
  33. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash_mac.egg-info/entry_points.txt +0 -0
  34. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash_mac.egg-info/requires.txt +0 -0
  35. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/src/devdash_mac.egg-info/top_level.txt +0 -0
  36. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/tests/test_app.py +0 -0
  37. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/tests/test_clipboard.py +0 -0
  38. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/tests/test_config.py +0 -0
  39. {devdash_mac-0.1.1 → devdash_mac-0.1.2}/tests/test_plugin_loader.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devdash-mac
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Open-source macOS menubar developer utilities
5
5
  Author: DevDash Contributors
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "devdash-mac"
7
- version = "0.1.1"
7
+ version = "0.1.2"
8
8
  description = "Open-source macOS menubar developer utilities"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -1,4 +1,4 @@
1
1
  """DevDash - Open-source macOS menubar developer utilities."""
2
2
 
3
- __version__ = "0.1.1"
3
+ __version__ = "0.1.2"
4
4
  __app_name__ = "DevDash"
@@ -1,5 +1,6 @@
1
1
  """User preferences management with YAML config."""
2
2
 
3
+ import logging
3
4
  import os
4
5
  import threading
5
6
  from pathlib import Path
@@ -7,8 +8,11 @@ from typing import Any
7
8
 
8
9
  import yaml
9
10
 
10
- CONFIG_DIR = Path.home() / ".config" / "devdash"
11
- CONFIG_FILE = CONFIG_DIR / "config.yaml"
11
+ logger = logging.getLogger(__name__)
12
+
13
+ # Try ~/.config/devdash first, fall back to ~/Library/Application Support/devdash
14
+ _PRIMARY_DIR = Path.home() / ".config" / "devdash"
15
+ _FALLBACK_DIR = Path.home() / "Library" / "Application Support" / "devdash"
12
16
 
13
17
  _lock = threading.Lock()
14
18
 
@@ -22,22 +26,38 @@ DEFAULT_CONFIG: dict[str, Any] = {
22
26
  }
23
27
 
24
28
 
25
- def _ensure_config_dir() -> None:
26
- """Create config directory if it doesn't exist."""
27
- CONFIG_DIR.mkdir(parents=True, exist_ok=True)
29
+ def _resolve_config_dir() -> Path:
30
+ """Find a writable config directory."""
31
+ for candidate in (_PRIMARY_DIR, _FALLBACK_DIR):
32
+ try:
33
+ candidate.mkdir(parents=True, exist_ok=True)
34
+ return candidate
35
+ except PermissionError:
36
+ continue
37
+ # Last resort: use home directory directly
38
+ return Path.home() / ".devdash"
39
+
40
+
41
+ CONFIG_DIR = _resolve_config_dir()
42
+ CONFIG_FILE = CONFIG_DIR / "config.yaml"
28
43
 
29
44
 
30
45
  def load_config() -> dict[str, Any]:
31
46
  """Load config from file, creating defaults on first run."""
32
47
  with _lock:
33
48
  if not CONFIG_FILE.exists():
34
- save_config(DEFAULT_CONFIG)
49
+ try:
50
+ save_config(DEFAULT_CONFIG)
51
+ except PermissionError:
52
+ logger.warning("Cannot create config file at %s", CONFIG_FILE)
53
+ return dict(DEFAULT_CONFIG)
54
+ try:
55
+ with open(CONFIG_FILE) as f:
56
+ data = yaml.safe_load(f)
57
+ except (PermissionError, OSError):
35
58
  return dict(DEFAULT_CONFIG)
36
- with open(CONFIG_FILE) as f:
37
- data = yaml.safe_load(f)
38
59
  if not isinstance(data, dict):
39
60
  return dict(DEFAULT_CONFIG)
40
- # Merge with defaults for any missing keys
41
61
  merged = dict(DEFAULT_CONFIG)
42
62
  merged.update(data)
43
63
  return merged
@@ -45,7 +65,7 @@ def load_config() -> dict[str, Any]:
45
65
 
46
66
  def save_config(config: dict[str, Any]) -> None:
47
67
  """Save config to file with restricted permissions."""
48
- _ensure_config_dir()
68
+ CONFIG_DIR.mkdir(parents=True, exist_ok=True)
49
69
  with open(CONFIG_FILE, "w") as f:
50
70
  yaml.dump(config, f, default_flow_style=False)
51
71
  os.chmod(CONFIG_FILE, 0o600)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devdash-mac
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Open-source macOS menubar developer utilities
5
5
  Author: DevDash Contributors
6
6
  License: MIT
File without changes
File without changes
File without changes