Sha256: 89de5cd84db29f5af50698ab9fa58512bace1848f798351dd1b12da05ca3e121
Contents?: true
Size: 1003 Bytes
Versions: 5
Compression:
Stored size: 1003 Bytes
Contents
module FunWith module Files module FilePathClassMethods # args implicitly joined to cwd def cwd( *args ) Dir.pwd.fwf_filepath.join( *args ) end def pwd( *args ) self.cwd( *args ) end def home( *args ) Dir.home.fwf_filepath.join( *args ) end def config_dir( *args ) XDG['CONFIG'].fwf_filepath.join( *args ) end def data_dir( *args ) XDG['DATA'].fwf_filepath.join( *args ) end # Honestly this is a token attempt at Windows compatibility. # This could go wrong all sorts of ways, and hasn't been tested # on Windows. More to the point, when a Windows machine has # multiple drives mounted, what do you even call the root? def root( *args ) if self.home =~ /^[a-zA-Z]:/ self.home.to_s[0..3].fwf_filepath.join( *args ) else "/".fwf_filepath.join( *args ) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems