Skip to content

Commit

Permalink
fix: change back to old log dir after breaking change in platformdirs…
Browse files Browse the repository at this point in the history
…, pinned platformdirs
  • Loading branch information
ErikBjare committed Oct 18, 2023
1 parent 99aa54e commit 6b3d670
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
11 changes: 9 additions & 2 deletions aw_core/dirs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import sys
from functools import wraps
from typing import Optional, Callable
from typing import Callable, Optional

import platformdirs

Expand Down Expand Up @@ -42,5 +43,11 @@ def get_config_dir(module_name: Optional[str] = None) -> str:

@_ensure_returned_path_exists
def get_log_dir(module_name: Optional[str] = None) -> str: # pragma: no cover
log_dir = platformdirs.user_log_dir("activitywatch")
# on Linux/Unix, platformdirs changed to using XDG_STATE_HOME instead of XDG_DATA_HOME for log_dir in v2.6
# we want to keep using XDG_DATA_HOME for backwards compatibility
# https://github.com/ActivityWatch/aw-core/pull/122#issuecomment-1768020335
if sys.platform.startswith("linux"):
log_dir = platformdirs.user_data_path("activitywatch") / "log"
else:
log_dir = platformdirs.user_log_dir("activitywatch")
return os.path.join(log_dir, module_name) if module_name else log_dir
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ aw-cli = "aw_cli.__main__:main"
python = "^3.8"
jsonschema = "^4.3"
peewee = "3.*"
platformdirs = "^3.8.0"
platformdirs = "3.10" # pinned due to sometimes breaking changes in minor versions: https://github.com/ActivityWatch/aw-core/pull/122#issuecomment-1768020335
iso8601 = "^1.0.2"
rfc3339-validator = "^0.1.4" # needed for the date-type format in jsonschema
strict-rfc3339 = "^0.7"
Expand Down

0 comments on commit 6b3d670

Please sign in to comment.