Fork me on GitHub
#calva
<
2020-09-09
>
borkdude09:09:33

Any Windows users here? If you specify config for a command line tool (like clj-kondo), where would you expect this on Windows? Clj-kondo expects it to be in C:\Users\foobar\.config\clj-kondo, in the next version. But someone commented here that Windows has a specific API for this: https://github.com/borkdude/clj-kondo/issues/992#issuecomment-689446189 Personally I'd rather look in .config\clj-kondo then some weird AppData folder nested somewhere deeply with GUID-named dirs.

chuck.cassel11:09:48

I would say 'idiomatic' Windows CLI would be either %USERPROFILE%\.config\clj-kondo (matches git, scoop)`%USERPROFILE%\.clj-kondo\config` (matches AWS CLI, dotnet core cli tools) or possibly something like %LOCALAPPDATA%\clj-kondo

chuck.cassel11:09:26

or in the case of that doc FOLDERID_LocalAppData or FOLDERID_Profile would be the base directory I'd start looking in if I wanted to find an applications config folder

borkdude11:09:43

What is FOLDERID

borkdude11:09:26

I have a preference for %USERPROFILE%\.config\clj-kondo since that also matches linux and macOS

ales.najmann12:09:04

I would probably build a list of candidate paths and walk through them in search for the config. Some people may prefer %APPDATA%/clj-kondo/config

borkdude12:09:59

$env:APPDATA
C:\Users\borkdude\AppData\Roaming
You can control that with XDG_CONFIG_HOME set to APPDATA if you want that.

ales.najmann12:09:14

yeah, it's somehow what I suggested 🙂

ales.najmann12:09:56

Some machines have different local and roaming profile, but I cannot tell what are the consequences of that.

borkdude12:09:26

well, not really. clj-kondo will not scan a list, it will check the default location unless you have overriden it with XDG_CONFIG_HOME. If people use roaming profiles, they should probably use that

borkdude12:09:47

and then hope that Visual Studio Code etc also picks up on that. I think so right

chuck.cassel12:09:20

if you're locating the base folder via APPDATA environment variable roaming/local profile should 'just work' , LOCALAPPDATA would not sync between machines if user had a roaming profile

borkdude12:09:33

Seems to work:

borkdude12:09:28

So I think this gives enough flexibility?

ales.najmann12:09:23

So if I understand correctly people who want to use clj-kondo would be advised to set environment variable XDG_CONFIG_HOME properly based on their system?

ales.najmann12:09:53

and clj-kondo will use just that on all the platforms equally?

borkdude12:09:47

clj-kondo will look in $XDG_CONFIG_HOME/clj-kondo if the env var is set, else in $HOME/.config/clj-kondo . Same on all OSes.

ales.najmann12:09:13

Sounds quite ok to me.

borkdude12:09:02

where $HOME = %userprofile% on Windows of course

borkdude12:09:18

it's actually using the Java property user.home

borkdude19:09:50

related to our conversation yesterday