X-Git-Url: https://git.proxmox.com/?p=pve-client.git;a=blobdiff_plain;f=PVE%2FAPIClient%2FHelpers.pm;h=8a96e8135a7fa47f6d6a94f2b167bd7a11d70fa4;hp=cc1951401d3247b5682a35857a164471f71cf8d0;hb=0ca370283dcfe778a1ff2473e4952dbf13a40683;hpb=b8b2e694f1fa0f574b4b7349aa68c5659fbe0420 diff --git a/PVE/APIClient/Helpers.pm b/PVE/APIClient/Helpers.pm index cc19514..8a96e81 100644 --- a/PVE/APIClient/Helpers.pm +++ b/PVE/APIClient/Helpers.pm @@ -273,4 +273,18 @@ sub poll_task { return $task_status->{exitstatus}; } +sub configuration_directory { + + my $home = $ENV{HOME} // ''; + my $xdg = $ENV{XDG_CONFIG_HOME} // ''; + + my $subdir = "pveclient"; + + return "$xdg/$subdir" if length($xdg); + + return "$home/.config/$subdir" if length($home); + + die "neither XDG_CONFIG_HOME nor HOME environment variable set\n"; +} + 1;