Module: StickyFlag::Paths

Included in:
ThorApp
Defined in:
lib/stickyflag/paths.rb

Instance Method Summary collapse

Instance Method Details

#config_pathObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/stickyflag/paths.rb', line 7

def config_path
  # No code coverage: only ever runs one operating system branch
  #:nocov:
  case RbConfig::CONFIG['target_os']
  when /darwin/i
    root_dir = File.expand_path("~/Library/Application Support/StickyFlag")
  when /linux/i
    require 'xdg'
    root_dir = File.join(XDG['CONFIG_HOME'].to_s, 'stickyflag')
  when /mswin|mingw/i
    root_dir = File.join(ENV['APPDATA'], 'StickyFlag')
  else
    root_dir = File.expand_path('~/.stickyflag')
  end
  #:nocov:
  
  FileUtils.mkdir_p root_dir
  File.join(root_dir, 'config.yml')
end

#database_pathObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/stickyflag/paths.rb', line 27

def database_path
  # No code coverage: only ever runs one operating system branch
  #:nocov:
  case RbConfig::CONFIG['target_os']
  when /darwin/i
    root_dir = File.expand_path("~/Library/Application Support/StickyFlag")
  when /linux/i
    require 'xdg'
    root_dir = File.join(XDG['DATA_HOME'].to_s, 'stickyflag')
  when /mswin|mingw/i
    root_dir = File.join(ENV['APPDATA'], 'StickyFlag')
  else
    root_dir = File.expand_path('~/.stickyflag')
  end
  #:nocov:

  FileUtils.mkdir_p root_dir
  File.join(root_dir, 'db.sqlite')
end