module FunWith::Files::FilePathClassMethods

Public Instance Methods

config_dir( *args ) click to toggle source
# File lib/fun_with/files/file_path_class_methods.rb, line 17
def config_dir( *args )
  XDG['CONFIG'].fwf_filepath.join( *args )
end
cwd( *args ) click to toggle source

args implicitly joined to cwd

# File lib/fun_with/files/file_path_class_methods.rb, line 5
def cwd( *args )
  Dir.pwd.fwf_filepath.join( *args )
end
data_dir( *args ) click to toggle source
# File lib/fun_with/files/file_path_class_methods.rb, line 21
def data_dir( *args )
  XDG['DATA'].fwf_filepath.join( *args )
end
home( *args ) click to toggle source
# File lib/fun_with/files/file_path_class_methods.rb, line 13
def home( *args )
  Dir.home.fwf_filepath.join( *args )
end
pwd( *args ) click to toggle source
# File lib/fun_with/files/file_path_class_methods.rb, line 9
def pwd( *args )
  self.cwd( *args )
end
root( *args ) click to toggle source

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?

# File lib/fun_with/files/file_path_class_methods.rb, line 29
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