[pve-devel] [PATCH client 2/3] config: use more xdg compliant search path

Dietmar Maurer dietmar at proxmox.com
Tue Jun 12 06:34:54 CEST 2018


I don't really like the idea to use different file names:

 .config
 client
 .pveclient

???

> +    # If XDG_CONFIG_HOME is not set or empty, its default is $HOME/.config
> +    my $base = $xdg || "$home/.config";
> +
> +    my $filename = "$base/pve/client";
> +    return $filename if -e $filename;
> +
> +    return "$home/.pveclient" if -e "$home/.pveclient";
> +
> +    return $filename;
>  }
>  
>  sub load {
> @@ -119,6 +133,7 @@ sub save {
>      my ($class, $cfg) = @_;
>  
>      my $filename = $class->config_filename();
> +    make_path(dirname($filename));
>      my $raw = $class->write_config($filename, $cfg);
>  
>      file_set_contents($filename, $raw, 0600);
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel



More information about the pve-devel mailing list