I'm trying to follow XDG directory specification on my Java application. I have already used it for application data:
protected String getDefaultDataDir() {
String rootPath = System.getenv("XDG_DATA_HOME");
if(rootPath == null) {
rootPath = System.getProperty("user.home")+S+".local"+S+"share";
}
return rootPath+S+Pinocchio.PLATFORMNAME;
}
( S is a constant containing System.getProperty("file.separator"))
I want now to store documents on the user documents' folder. But I don't have an environment variable named XDG_DOCUMENTS_DIR. I have the ".config/user-dirs.dirs" file that have that XDG configuration, and the "xdg-user-dir DOCUMENTS" which directly returns that path.
Making things worse, the default documents directory depends on the user locale.
Which is the best way to use the configured Documents directory on a java application?