xdg 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY ADDED
@@ -0,0 +1,5 @@
1
+ ### 0.3.0 / 2008-09-11
2
+
3
+ * Renamed module level methods without 'xdg_' prefix.
4
+ * The xdg_ versions still exist for backward compatibility.
5
+
data/MANIFEST CHANGED
@@ -1,14 +1,22 @@
1
- doc
2
- doc/book
3
- doc/book/basedir-spec-0.6.html
4
1
  test
2
+ test/fakeroot
3
+ test/fakeroot/home
4
+ test/fakeroot/usr
5
+ test/fakeroot/usr/share
6
+ test/fakeroot/usr/share/bar.dat
7
+ test/fakeroot/etc
8
+ test/fakeroot/etc/xdg
9
+ test/fakeroot/etc/xdg/bar.config
10
+ test/test_xdg.rb
5
11
  RELEASE
6
12
  README
13
+ HISTORY
7
14
  meta
8
15
  meta/homepage
9
16
  meta/summary
10
17
  meta/abstract
11
18
  meta/releases
19
+ meta/title
12
20
  meta/authors
13
21
  meta/contact
14
22
  lib
data/README CHANGED
@@ -1,29 +1,51 @@
1
- = XDG
1
+ = XDG Base Directory Standards for Ruby
2
+
3
+ http://xdg.rubyforge.org
4
+
5
+ == Introduction
2
6
 
3
7
  XDG provides an easy to use interface for utilizing
4
- the XDG Base Base Directory Standards.
8
+ the XDG Base Directory Standards.
9
+
10
+ See: http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html
11
+
12
+ == Release Notes
13
+
14
+ Please see the RELEASE file.
5
15
 
6
16
  == Usage
7
17
 
8
- XDG is a module with a small set of easy to understand
9
- module methods, so it very easy to use.
18
+ XDG is a module with a small set of easy to use methods:
10
19
 
11
- See RDOC's for more information.
20
+ XDG.config_home
21
+ XDG.config_dirs
22
+ XDG.data_home
23
+ XDG.data_dirs
24
+ XDG.cache_home
25
+
26
+ XDG.data_file(file)
27
+ XDG.config_file(file)
28
+ XDG.cache_file(file)
29
+
30
+ XDG.config_work
31
+ XDG.data_work
32
+ XDG.cache_work
33
+
34
+ If you know XDG these are pretty much self-explanitory.
35
+ But see the RDocs for specifics.
12
36
 
13
37
  == Installation
14
38
 
15
- === RubyGems
39
+ Using RubyGems:
16
40
 
17
41
  $ gem install xdg
18
42
 
19
- === Tarball
20
-
21
43
  Installing the tarball requires Ruby Setup
22
44
  (see http://setup.rubyforge.org).
23
45
 
24
- $ tar -xvzf xdg-0.1.0
25
- $ cd xdg-0.1.0
26
- $ setup.rb all
46
+ $ tar -xvzf xdg-0.4.1
47
+ $ cd xdg-0.4.1
48
+ $ sudo setup.rb all
27
49
 
28
50
  == Development
29
51
 
data/RELEASE CHANGED
@@ -1,5 +1,10 @@
1
- This is the initial release of XDG.
1
+ This release removes the xdg_ prefix from the module-level
2
+ method names. The instance methods retain the xdg_ prefix.
3
+ I will consider if they should also be removed for the
4
+ next release.
2
5
 
3
- XDG provides a straight-forward interface for supporting
4
- the XDG Base Directory Standard.
6
+ ### 0.3.0 / 2008-09-11
7
+
8
+ * Renamed module level methods without 'xdg_' prefix.
9
+ * The xdg_ versions still exist for backward compatibility.
5
10
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- xdg 0.1.0 beta (2008-09-27)
1
+ xdg 0.3.0 beta (2008-09-30)
data/lib/xdg.rb CHANGED
@@ -32,81 +32,82 @@
32
32
 
33
33
  module XDG
34
34
 
35
- ###############
36
- module_function
37
- ###############
38
-
39
- def xdg_home
35
+ def self.home
40
36
  ENV['HOME'] || File.expand_path('~')
41
37
  end
42
38
 
43
39
  # Location of user's personal config directory.
44
- def xdg_config_home
40
+ def self.config_home
45
41
  File.expand_path(
46
42
  ENV['XDG_CONFIG_HOME'] || File.join(xdg_home, '.config')
47
43
  )
48
44
  end
49
45
 
50
46
  # List of user's shared config directories.
51
- def xdg_config_dirs
52
- dirs = ENV['XDG_CONFIG_DIRS'].split(/[:;]/)
47
+ def self.config_dirs
48
+ dirs = ENV['XDG_CONFIG_DIRS'].to_s.split(/[:;]/)
53
49
  if dirs.empty?
54
50
  dirs = %w{/etc/xdg}
55
51
  end
56
- dir.collect{ |d| File.expand_path(d) }
52
+ dirs.collect{ |d| File.expand_path(d) }
57
53
  end
58
54
 
59
55
  # Location of user's personal data directory.
60
- def xdg_data_home
56
+ def self.data_home
61
57
  File.expand_path(
62
58
  ENV['XDG_DATA_HOME'] || File.join(xdg_home, '.local', 'share')
63
59
  )
64
60
  end
65
61
 
66
62
  # List of user's shared data directores.
67
- def xdg_data_dirs
63
+ def self.data_dirs
68
64
  dirs = ENV['XDG_DATA_DIRS'].split(/[:;]/)
69
65
  if dirs.empty?
70
66
  dirs = %w{/usr/local/share/ /usr/share/}
71
67
  end
72
- dir.collect{ |d| File.expand_path(d) }
68
+ dirs.collect{ |d| File.expand_path(d) }
73
69
  end
74
70
 
75
71
  # Location of user's personal cache directory.
76
- def xdg_cache_home
72
+ def self.cache_home
77
73
  File.expand_path(
78
74
  ENV['XDG_CACHE_HOME'] || File.join(xdg_home, '.cache')
79
75
  )
80
76
  end
81
77
 
82
78
  # Find a file or directory in data dirs.
83
- def xdg_data_file(file)
84
- [data_home, *data_dirs].each do |dir|
79
+ def self.data_file(file)
80
+ find = nil
81
+ [xdg_data_home, *xdg_data_dirs].each do |dir|
85
82
  path = File.join(dir,file)
86
- break path if File.exist?(path)
83
+ break find = path if File.exist?(path)
87
84
  end
85
+ find
88
86
  end
89
87
 
90
88
  # Find a file or directory in config dirs.
91
- def xdg_config_file(file)
92
- [config_home, *config_dirs].each do |dir|
89
+ def self.config_file(file)
90
+ find = nil
91
+ [xdg_config_home, *xdg_config_dirs].each do |dir|
93
92
  path = File.join(dir,file)
94
- break path if File.exist?(path)
93
+ break find = path if File.exist?(path)
95
94
  end
95
+ find
96
96
  end
97
97
 
98
98
  # Find a file or directory in the user cache.
99
- def xdg_cache_file(file)
100
- File.join(cache_home,file)
99
+ def self.cache_file(file)
100
+ path = File.join(xdg_cache_home,file)
101
+ File.exist?(path) ? path : nil
101
102
  end
102
103
 
103
- ############################################
104
- # The following are not strictly XDG spec, #
105
- # but are useful in the same respect. #
106
- ############################################
104
+ #--
105
+ # The following are not strictly XDG spec,
106
+ # but are useful in the same respect.
107
+ #++
107
108
 
108
109
  # Location of working config directory.
109
- def xdg_config_work
110
+ def self.config_work
110
111
  File.expand_path(
111
112
  #ENV['XDG_CONFIG_WORK'] || File.join(Dir.pwd, '.config')
112
113
  File.join(Dir.pwd, '.config')
@@ -114,7 +115,7 @@ module XDG
114
115
  end
115
116
 
116
117
  # Location of working data directory.
117
- def xdg_data_work
118
+ def self.data_work
118
119
  File.expand_path(
119
120
  #ENV['XDG_DATA_WORK'] || File.join(Dir.pwd, '.share')
120
121
  File.join(Dir.pwd, '.share')
@@ -122,12 +123,31 @@ module XDG
122
123
  end
123
124
 
124
125
  # Location of working cache directory.
125
- def xdg_cache_work
126
+ def self.cache_work
126
127
  File.expand_path(
127
128
  #ENV['XDG_CACHE_WORK'] || File.join(Dir.pwd, '.cache')
128
129
  File.join(Dir.pwd, '.cache')
129
130
  )
130
131
  end
131
132
 
133
+ ###############
134
+ module_function
135
+ ###############
136
+
137
+ def xdg_home ; XDG.home ; end
138
+ def xdg_config_home ; XDG.config_home ; end
139
+ def xdg_config_dirs ; XDG.config_dirs ; end
140
+ def xdg_data_home ; XDG.data_home ; end
141
+ def xdg_data_dirs ; XDG.data_dirs ; end
142
+ def xdg_cache_home ; XDG.cache_home ; end
143
+
144
+ def xdg_data_file(file) ; XDG.data_file(file) ; end
145
+ def xdg_config_file(file) ; XDG.config_file(file) ; end
146
+ def xdg_cache_file(file) ; XDG.cache_file(file) ; end
147
+
148
+ def xdg_config_work ; XDG.config_work ; end
149
+ def xdg_data_work ; XDG.data_work ; end
150
+ def xdg_cache_work ; XDG.cache_work ; end
151
+
132
152
  end # module XDG
133
153
 
@@ -1 +1,3 @@
1
- XDG provides and interface for using the XDG directory standard.
1
+ XDG provides a module for supporting the XDG Base Directory Standard.
2
+ See: http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html
3
+
@@ -0,0 +1 @@
1
+ XDG
@@ -0,0 +1 @@
1
+ BAR.CONFIG
@@ -0,0 +1 @@
1
+ BAR.DAT
@@ -0,0 +1,76 @@
1
+ require 'test/unit'
2
+ $: << 'lib'
3
+ require 'xdg'
4
+
5
+ # run test from fakeroot directory.
6
+ Dir.chdir(File.join(File.dirname(__FILE__), 'fakeroot'))
7
+
8
+ ENV['HOME'] = File.join(Dir.pwd, 'home')
9
+ ENV['XDG_DATA_DIRS'] = File.join(Dir.pwd, 'usr/share')
10
+ ENV['XDG_CONFIG_DIRS'] = File.join(Dir.pwd, 'etc/xdg')
11
+
12
+ class TestXDG < Test::Unit::TestCase
13
+
14
+ # Test the standard paths.
15
+
16
+ def test_xdg_home
17
+ assert_equal(File.join(Dir.pwd,'home'), XDG.xdg_home)
18
+ end
19
+
20
+ def test_xdg_config_home
21
+ assert_equal(File.join(Dir.pwd,'home/.config'), XDG.xdg_config_home)
22
+ end
23
+
24
+ def test_xdg_config_dirs
25
+ assert_equal([File.join(Dir.pwd,"etc/xdg")], XDG.xdg_config_dirs)
26
+ end
27
+
28
+ def test_xdg_data_home
29
+ assert_equal(File.join(Dir.pwd,'home/.local/share'), XDG.xdg_data_home)
30
+ end
31
+
32
+ def test_xdg_data_dirs
33
+ assert_equal([File.join(Dir.pwd,'usr/share')], XDG.xdg_data_dirs)
34
+ end
35
+
36
+ def test_xdg_cache_home
37
+ assert_equal(File.join(Dir.pwd,'home/.cache'), XDG.xdg_cache_home)
38
+ end
39
+
40
+ # Test the file lookups.
41
+
42
+ def test_xdg_data_file
43
+ file = 'foo.dat'
44
+ assert_equal(File.join(Dir.pwd,'home/.local/share', file), XDG.xdg_data_file(file))
45
+ file = 'bar.dat'
46
+ assert_equal(File.join(Dir.pwd,'usr/share', file), XDG.xdg_data_file(file))
47
+ end
48
+
49
+ def test_xdg_config_file
50
+ file = 'foo.config'
51
+ assert_equal(File.join(Dir.pwd,'home/.config', file), XDG.xdg_config_file(file))
52
+ file = 'bar.config'
53
+ assert_equal(File.join(Dir.pwd,'etc/xdg', file), XDG.xdg_config_file(file))
54
+ end
55
+
56
+ def test_xdg_cache_file
57
+ file = 'foo.cache'
58
+ assert_equal(File.join(Dir.pwd,'home/.cache', file), XDG.xdg_cache_file(file))
59
+ end
60
+
61
+ # Test the working directory variations.
62
+
63
+ def test_xdg_config_work
64
+ assert_equal(File.join(Dir.pwd,'.config'), XDG.xdg_config_work)
65
+ end
66
+
67
+ def test_xdg_data_work
68
+ assert_equal(File.join(Dir.pwd,'.share'), XDG.xdg_data_work)
69
+ end
70
+
71
+ def test_xdg_cache_work
72
+ assert_equal(File.join(Dir.pwd,'.cache'), XDG.xdg_cache_work)
73
+ end
74
+
75
+ end
76
+
metadata CHANGED
@@ -1,22 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xdg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
- - |
8
- tigerops-community@rubyforge.org
9
-
7
+ - tigerops-community@rubyforge.org
10
8
  - 7rans <transfire@gmail.com>
11
9
  autorequire:
12
10
  bindir: bin
13
11
  cert_chain: []
14
12
 
15
- date: 2008-09-27 00:00:00 -04:00
13
+ date: 2008-10-11 00:00:00 -04:00
16
14
  default_executable:
17
15
  dependencies: []
18
16
 
19
- description: XDG provides and interface for using the XDG directory standard.
17
+ description: "XDG provides a module for supporting the XDG Base Directory Standard. See: http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html"
20
18
  email:
21
19
  executables: []
22
20
 
@@ -26,21 +24,30 @@ extra_rdoc_files:
26
24
  - README
27
25
  - MANIFEST
28
26
  - RELEASE
27
+ - HISTORY
29
28
  - VERSION
30
29
  - COPYING
31
30
  files:
32
- - doc
33
- - doc/book
34
- - doc/book/basedir-spec-0.6.html
35
31
  - MANIFEST
36
32
  - test
33
+ - test/fakeroot
34
+ - test/fakeroot/home
35
+ - test/fakeroot/usr
36
+ - test/fakeroot/usr/share
37
+ - test/fakeroot/usr/share/bar.dat
38
+ - test/fakeroot/etc
39
+ - test/fakeroot/etc/xdg
40
+ - test/fakeroot/etc/xdg/bar.config
41
+ - test/test_xdg.rb
37
42
  - RELEASE
38
43
  - README
44
+ - HISTORY
39
45
  - meta
40
46
  - meta/homepage
41
47
  - meta/summary
42
48
  - meta/abstract
43
49
  - meta/releases
50
+ - meta/title
44
51
  - meta/authors
45
52
  - meta/contact
46
53
  - lib
@@ -48,9 +55,7 @@ files:
48
55
  - VERSION
49
56
  - COPYING
50
57
  has_rdoc: true
51
- homepage: |
52
- http://xdg.rubyforge.org
53
-
58
+ homepage: http://xdg.rubyforge.org
54
59
  post_install_message:
55
60
  rdoc_options:
56
61
  - --inline-source
@@ -78,6 +83,14 @@ rubyforge_project: xdg
78
83
  rubygems_version: 1.2.0
79
84
  signing_key:
80
85
  specification_version: 2
81
- summary: XDG provides and interface for using the XDG directory standard.
82
- test_files: []
83
-
86
+ summary: XDG provides a module for supporting the XDG Base Directory Standard.
87
+ test_files:
88
+ - test/fakeroot
89
+ - test/fakeroot/home
90
+ - test/fakeroot/usr
91
+ - test/fakeroot/usr/share
92
+ - test/fakeroot/usr/share/bar.dat
93
+ - test/fakeroot/etc
94
+ - test/fakeroot/etc/xdg
95
+ - test/fakeroot/etc/xdg/bar.config
96
+ - test/test_xdg.rb
@@ -1,138 +0,0 @@
1
- <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>XDG Base Directory Specification</title><meta name="generator" content="DocBook XSL Stylesheets V1.66.1"></head><body link="#0000ff" alink="#0000ff" bgcolor="white" text="black" vlink="#840084"><div class="article" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="index"></a>XDG Base Directory Specification</h1></div><div><div class="authorgroup"><div class="author"><h3 class="author"><span class="firstname">Waldo</span> <span class="surname">Bastian</span></h3><div class="affiliation"><div class="address"><p><br>
2
- &nbsp;&nbsp;&nbsp;&nbsp;<tt class="email">&lt;<a href="mailto:bastian@kde.org">bastian@kde.org</a>&gt;</tt><br>
3
- &nbsp;&nbsp;</p></div></div></div></div></div><div><p class="releaseinfo">Version 0.6</p></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#introduction">Introduction</a></span></dt><dt><span class="sect1"><a href="#basics">Basics</a></span></dt><dt><span class="sect1"><a href="#variables">Environment variables</a></span></dt><dt><span class="sect1"><a href="#referencing">Referencing this specification</a></span></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both;"><a name="introduction"></a>Introduction</h2></div></div></div><p>
4
- Various specifications specify files and file formats. This
5
- specification defines where these files should be looked for by
6
- defining one or more base directories relative to which files
7
- should be located.
8
- </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both;"><a name="basics"></a>Basics</h2></div></div></div><p>
9
- The XDG Base Directory Specification is based on the following concepts:
10
- </p><div class="itemizedlist"><ul type="disc"><li><p>
11
- There is a single base directory relative to which user-specific
12
- data files should be written. This directory is defined by the
13
- environment variable <tt class="literal">$XDG_DATA_HOME</tt>.
14
- </p></li><li><p>
15
- There is a single base directory relative to which user-specific
16
- configuration files should be written. This directory is defined by the
17
- environment variable <tt class="literal">$XDG_CONFIG_HOME</tt>.
18
- </p></li><li><p>
19
- There is a set of preference ordered base directories relative to
20
- which data files should be searched. This set of directories is defined
21
- by the environment variable <tt class="literal">$XDG_DATA_DIRS</tt>.
22
- </p></li><li><p>
23
- There is a set of preference ordered base directories relative to
24
- which configuration files should be searched.
25
- This set of directories is defined
26
- by the environment variable <tt class="literal">$XDG_CONFIG_DIRS</tt>.
27
- </p></li><li><p>
28
- There is a single base directory relative to which user-specific
29
- non-essential (cached) data should be written.
30
- This directory is defined by the
31
- environment variable <tt class="literal">$XDG_CACHE_HOME</tt>.
32
- </p></li></ul></div><p>
33
- </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both;"><a name="variables"></a>Environment variables</h2></div></div></div><p>
34
- <tt class="literal">$XDG_DATA_HOME</tt> defines the base directory relative to
35
- which user specific data files should be stored. If
36
- <tt class="literal">$XDG_DATA_HOME</tt> is either not set or empty, a default equal to
37
- <tt class="literal">$HOME</tt>/.local/share should be used.
38
- </p><p>
39
- <tt class="literal">$XDG_CONFIG_HOME</tt> defines the base directory relative to
40
- which user specific configuration files should be stored. If
41
- <tt class="literal">$XDG_CONFIG_HOME</tt> is either not set or empty, a default equal to
42
- <tt class="literal">$HOME</tt>/.config should be used.
43
- </p><p>
44
- <tt class="literal">$XDG_DATA_DIRS</tt> defines the preference-ordered set of
45
- base directories to search for data files in addition to the
46
- <tt class="literal">$XDG_DATA_HOME</tt> base directory.
47
- The directories in <tt class="literal">$XDG_DATA_DIRS</tt> should be seperated
48
- with a colon ':'.
49
- </p><p>
50
- If <tt class="literal">$XDG_DATA_DIRS</tt> is either not set or empty, a value equal to
51
- /usr/local/share/:/usr/share/ should be used.
52
- </p><p>
53
- <tt class="literal">$XDG_CONFIG_DIRS</tt> defines the preference-ordered set of
54
- base directories to search for configuration files in addition to the
55
- <tt class="literal">$XDG_CONFIG_HOME</tt> base directory.
56
- The directories in <tt class="literal">$XDG_CONFIG_DIRS</tt> should be seperated
57
- with a colon ':'.
58
- </p><p>
59
- If <tt class="literal">$XDG_CONFIG_DIRS</tt> is either not set or empty, a value equal to
60
- /etc/xdg should be used.
61
- </p><p>
62
- The order of base directories denotes their importance; the first
63
- directory listed is the most important. When the same information is
64
- defined in multiple places the information defined relative to the more
65
- important base directory takes precedent. The base directory defined
66
- by <tt class="literal">$XDG_DATA_HOME</tt> is considered more important than
67
- any of the base directories defined by <tt class="literal">$XDG_DATA_DIRS</tt>.
68
- The base directory defined
69
- by <tt class="literal">$XDG_CONFIG_HOME</tt> is considered more important than
70
- any of the base directories defined by <tt class="literal">$XDG_CONFIG_DIRS</tt>.
71
- </p><p>
72
- <tt class="literal">$XDG_CACHE_HOME</tt> defines the base directory relative to
73
- which user specific non-essential data files should be stored. If
74
- <tt class="literal">$XDG_CACHE_HOME</tt> is either not set or empty, a default equal to
75
- <tt class="literal">$HOME</tt>/.cache should be used.
76
- </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both;"><a name="referencing"></a>Referencing this specification</h2></div></div></div><p>
77
- Other specifications may reference this specification by specifying the
78
- location of a data file as
79
- <tt class="literal">$XDG_DATA_DIRS</tt>/subdir/filename. This implies that:
80
- </p><div class="itemizedlist"><ul type="disc"><li><p>
81
- Such file should be installed to <tt class="literal">$datadir</tt>/subdir/filename
82
- with <tt class="literal">$datadir</tt> defaulting to /usr/share.
83
- </p></li><li><p>
84
- A user specific version of the data file may be created in
85
- <tt class="literal">$XDG_DATA_HOME</tt>/subdir/filename, taking into
86
- account the default value for <tt class="literal">$XDG_DATA_HOME</tt> if
87
- <tt class="literal">$XDG_DATA_HOME</tt> is not set.
88
- </p></li><li><p>
89
- Lookups of the data file should search for ./subdir/filename relative to
90
- all base directories specified by <tt class="literal">$XDG_DATA_HOME</tt> and
91
- <tt class="literal">$XDG_DATA_DIRS</tt> . If an environment
92
- variable is either not set or empty, its default value as defined by this specification
93
- should be used instead.
94
- </p></li></ul></div><p>
95
- </p><p>
96
- Specifications may reference this specification by specifying the
97
- location of a configuration file as
98
- <tt class="literal">$XDG_CONFIG_DIRS</tt>/subdir/filename. This implies that:
99
- </p><div class="itemizedlist"><ul type="disc"><li><p>
100
- Default configuration files should be installed to <tt class="literal">$sysconfdir</tt>/xdg/subdir/filename
101
- with <tt class="literal">$sysconfdir</tt> defaulting to /etc.
102
- </p></li><li><p>
103
- A user specific version of the configuration file may be created in
104
- <tt class="literal">$XDG_CONFIG_HOME</tt>/subdir/filename, taking into
105
- account the default value for <tt class="literal">$XDG_CONFIG_HOME</tt> if
106
- <tt class="literal">$XDG_CONFIG_HOME</tt> is not set.
107
- </p></li><li><p>
108
- Lookups of the configuration file should search for ./subdir/filename relative to
109
- all base directories indicated by <tt class="literal">$XDG_CONFIG_HOME</tt> and
110
- <tt class="literal">$XDG_CONFIG_DIRS</tt> . If an environment
111
- variable is either not set or empty, its default value as defined by this specification
112
- should be used instead.
113
- </p></li></ul></div><p>
114
- </p><p>
115
- If, when attempting to write a file, the destination
116
- directory is non-existant an attempt should be made to create it
117
- with permission <tt class="literal">0700</tt>. If the destination directory
118
- exists already the permissions should not be changed.
119
- The application should be prepared to handle the case where the file
120
- could not be written, either because the directory was non-existant
121
- and could not be created, or for any other reason. In such case it
122
- may chose to present an error message to the user.
123
- </p><p>
124
- When attempting to read a file, if for any reason a file in a certain
125
- directory is unaccessible, e.g. because the directory is non-existant,
126
- the file is non-existant or the user is not authorized to open the file,
127
- then the processing of the file in that directory should be skipped.
128
- If due to this a required file could not be found at all, the
129
- application may chose to present an error message to the user.
130
- </p><p>
131
- A specification that refers to <tt class="literal">$XDG_DATA_DIRS</tt> or
132
- <tt class="literal">$XDG_CONFIG_DIRS</tt> should define what the behaviour
133
- must be when a file is located under multiple base directories.
134
- It could, for example, define that only the file under the most
135
- important base directory should be used or, as another example,
136
- it could define rules for merging the information from the different
137
- files.
138
- </p></div></div></body></html>