Using a more accurate root directory

Dir.pwd will not provide a valid directory
name when the app is started from any other directory.
This prevents monitoring apps (like god) from
starting an application without extra configuration.
This commit is contained in:
Jack Danger Canty 2008-04-19 11:14:43 -07:00
parent d7032a0c91
commit 5b3440e251
1 changed files with 4 additions and 3 deletions

View File

@ -828,13 +828,14 @@ module Sinatra
attr_writer :options
def self.default_options
root = File.expand_path(File.dirname($0))
@@default_options ||= {
:run => true,
:port => 4567,
:env => :development,
:root => Dir.pwd,
:views => Dir.pwd + '/views',
:public => Dir.pwd + '/public',
:root => root,
:views => root + '/views',
:public => root + '/public',
:sessions => false,
:logging => true,
}