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.
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
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
What is FOLDERID
I have a preference for %USERPROFILE%\.config\clj-kondo
since that also matches linux and macOS
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
$env:APPDATA
C:\Users\borkdude\AppData\Roaming
You can control that with XDG_CONFIG_HOME
set to APPDATA
if you want that.Exactly the same as scoop does: https://github.com/lukesampson/scoop/blob/master/lib/core.ps1#L967-L968
yeah, it's somehow what I suggested 🙂
Some machines have different local and roaming profile, but I cannot tell what are the consequences of that.
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
and then hope that Visual Studio Code etc also picks up on that. I think so right
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
Seems to work:
So I think this gives enough flexibility?
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?
and clj-kondo will use just that on all the platforms equally?
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.
Sounds quite ok to me.
where $HOME
= %userprofile%
on Windows of course
it's actually using the Java property user.home
@kardan This guide just came out today: https://docs.microsoft.com/en-us/windows/wsl/tutorials/wsl-containers
related to our conversation yesterday