mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-24 16:11:57 +00:00
respect XDG_DATA_HOME when looking for the timewarrior data directory (#2344)
The logic for finding the data directory is as follows: 1. Find the root directory: 1.1 If TIMEWARRIORDB is set, use that. 1.2 Else if ~/.timewarrior is an existing directory, use that. 1.3 Else if XDG_DATA_HOME is set, use $XDG_DATA_HOME/timewarrior. 1.4 Else use ~/.local/share/timewarrior. 2. Append "/data" to the root directory.
This commit is contained in:
parent
944f52fc43
commit
360dcd3907
1 changed files with 4 additions and 1 deletions
|
@ -5084,8 +5084,11 @@ function _p9k_timewarrior_clear() {
|
|||
}
|
||||
|
||||
function prompt_timewarrior() {
|
||||
local dir
|
||||
[[ -n ${dir::=$TIMEWARRIORDB} || -n ${dir::=~/.timewarrior}(#qN/) ]] ||
|
||||
dir=${XDG_DATA_HOME:-~/.local/share}/timewarrior
|
||||
dir+=/data
|
||||
local -a stat
|
||||
local dir=${TIMEWARRIORDB:-~/.timewarrior}/data
|
||||
[[ $dir == $_p9k_timewarrior_dir ]] || _p9k_timewarrior_clear
|
||||
if [[ -n $_p9k_timewarrior_file_name ]]; then
|
||||
zstat -A stat +mtime -- $dir $_p9k_timewarrior_file_name 2>/dev/null || stat=()
|
||||
|
|
Loading…
Reference in a new issue