appdirs takes care of OS dependent directories. Using it would be a small change to this file.
Related https://github.com/jupyterlab/jupyterlab/issues/10851