freedesktop.org


Should A Program Create XDG Folders?


Let's say I'm writing a program, and I want it to follow the XDG Base Directory Specification for where it puts its files (app foo uses $XDG_CONFIG_HOME/foo as the directory for configuration files if XDG_CONFIG_HOME is set and non-blank, or ~/.config/foo, or flails with an error if the home directory can't even be resolved).
Is there a correct/specified behavior for the situation where for example XDG_CONFIG_HOME is set and non-blank, but that directory doesn't exist? Or there is no such variable, and ~/.config doesn't exist? Is it expected that my program attempt to create it? Or is the non-existance of that folder considered an error on the environment's/system's part, and my program should avoid doing anything about it (just bail with an error)?
Note: I'm not asking if I should create ~/.config/foo - obviously that's a yes; I'm asking if I should create ~/.config itself, if it doesn't exist.
(To be more pedantic: obviously some program should create them - the question is whether it's solely the system's/desktop's/user's job to do so, or if any program should try creating the relevant folders if they don't exist?)
I've tried reading the XDG Base Directory Specification, which says that when attempting to write its files, the program may create the requisite directory, but it's unclear if this is referring to just the application's specific/"personal" subdirectory in the XDG base folders, or if this is meant for the XDG base folders themselves.
P.S. Usually I have a good idea of what tags to use, but here I'm really uncertain: please edit this post or suggest improvements to give it proper tags.
I'm posting my own very tentative/speculative answer based on my reasoning about the problem, but I would really like a more authoritative/definitive answer.
I think that a general maxim of being helpful and not doing what the user is likely to have asked in error is a good thing to consider: if I do XDG_DATA_HOME=~.l/ocal/share, I might have wanted exactly that, but it's much more likely that I made a typo. It seems logically sound that the most helpful, and least disruptive, thing to do, is to report the lack of the requested XDG directory in such a case.
Also, as I understand it, the goal of the specification is partly to reduce home directory clutter, so it seems counter-productive to willfully do the equivalent of mkdir -p each time.

Related Links

Should A Program Create XDG Folders?

Categories

HOME
clips
vbscript
plot
bookshelf.js
setup-deployment
mvvmcross
echarts
constraint-programming
swagger-ui
bs4
node-notifier
applepay
awesome-wm
iggrid
kibana-4
correlation
collectd
designer
jsprit
dosgi
opentracing
graphlab
ab-testing
cx-freeze
abi
zurb-foundation-6
cultureinfo
jndi
dxf
tdd
social-media
opentype
facebook-apps
key-value-observing
.net-4.0
perlin-noise
webtest
form-data
mpmediaquery
android-ble
bitbucket-pipelines
retina-display
lto
espeak
gulp-sourcemaps
node-gyp
arena-simulation
node-sass
jsch
revapi
react-scripts
gabor-filter
statsd
crypt
snmptrapd
android-cursor
pillow
hittest
or-tools
word-vba-mac
deadbolt-2
grails-tomcat-plugin
radtreelist
slicknav
google-web-starter-kit
django-debug-toolbar
autorest
simplewebrtc
ubuntu-10.04
yaws
bluemix-app-scan
bluegiga
php-parse-error
itextpdf
photobucket
jfugue
spim
execute
jms2
endeca-workbench
retina
remobjects
notify
bridge.net
truevault
apache-commons-net
facebook-graph-api-v2.4
operator-precedence
gwidgets
codeigniter-routing
asp.net-web-api-odata
websocket4net
has-many-through
cdc
dexterity
shellexecute
buster.js
yui-compressor
enterprisedb
path-separator
unc
bluepill
first-responder
cascalog
cufon
external-accessory
gcj
tomcat-valve
winbugs14
mongomapper
modelstate
memory-size
eqatec
yagni
wsdl.exe

Resources

Encrypt Message