lib/xdg.rb in xdg-0.5.1 vs lib/xdg.rb in xdg-0.5.2

- old
+ new

@@ -1,5 +1,7 @@ +require 'rbconfig' + # = XDG Base Directory Standard # # This provides a conveient library for conforming to the # XDG Base Directory Standard. # @@ -7,24 +9,24 @@ # # Some important clarifications, not made clear by the # above specification. # # The data directories are for "read-only" files. In other words once -# something is put there, it should only be read, never written to -# by a program. (Generally speaking only users or pacakge mangers should -# be adding, changing or removing files from the data locations. +# something is put there, it should only be read, and never written to +# by a program. (Generally speaking only users or package mangers should +# be adding, changing or removing files from the data locations.) # -# The config locations are where you should store files that may change, -# and effect operations depending one there content. This is like etc/ -# in the FHS, but alterable by end users and and end user programs, +# The config locations are where you store files that may change, +# and effect your applications depending on their content. This is like +# etc/ in the FHS, but alterable by end users and end user programs, # not just root and sudo admin scripts. # -# The cache location stores files that could judt as well be deleted -# and everyihtng still works find. This is for variable and temporary -# files. Like var/ in FHS. +# The cache locations stores files that could just as well be deleted +# and everyihtng would still work fine. This is for variable and +# temporary files. much like var/ in FHS. # -# This module returns paths as strings. +# The module returns all paths as String. # module XDG extend self #module_function @@ -42,11 +44,11 @@ # List of user's shared config directories. def config_dirs dirs = ENV['XDG_CONFIG_DIRS'].to_s.split(/[:;]/) if dirs.empty? - dirs = %w{/etc/xdg} + dirs = File.join(Config::CONFIG['sysconfdir'], 'xdg') #%w{/etc/xdg} end dirs.collect{ |d| File.expand_path(d) } end # Location of user's personal data directory. @@ -58,11 +60,11 @@ # List of user's shared data directores. def data_dirs dirs = ENV['XDG_DATA_DIRS'].split(/[:;]/) if dirs.empty? - dirs = %w{/usr/local/share/ /usr/share/} + dirs = [ Config::CONFIG['localdatadir'], Config::CONFIG['datadir'] ] #%w{/usr/local/share/ /usr/share/} end dirs.collect{ |d| File.expand_path(d) } end # Location of user's personal cache directory. @@ -229,10 +231,7 @@ ) end end # module XDG -# :Title: XDG -# :Author: &trans; -# :Copyright: (c)2008 Tiger Ops -# :License: GPLv3 - +# Copyright (c)2008 Tiger Ops / Trans +# Distributed under the terms of the GPL v3.