Method: Few#fewdir

Defined in:
lib/few.rb

#fewdir(path, runtime = false) ⇒ Object



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/few.rb', line 207

def fewdir(path,runtime=false)
  if $few_speccing || runtime
    return File.dirname(__FILE__) + '/../fewfiles/' + path
  else
    config_dirs = %w[.few fewfiles]
    config_dirs.delete_if{|x| !File.exist?(File.expand_path("~") + '/' + x)}
    if config_dirs.length > 0
      dir = File.expand_path("~") + '/' + config_dirs[0]
      dir+'/'+path
    else
      if /mswin(?!ce)|mingw|bccwin/ == RUBY_PLATFORM
        Dir.mkdir(File.expand_path('~') + '/fewfiles')
        return File.expand_path('~') + '/fewfiles/'+path
      else
        Dir.mkdir(File.expand_path('~') + '/.few')
        return File.expand_path('~') + '/.few/'+path
      end
    end
  end
end