Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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.
  • Loading branch information...
commit 5b3440e251a66abf6776a4d5259b579d828a3b4a 1 parent d7032a0
Jack Danger Canty JackDanger authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/sinatra.rb
7 lib/sinatra.rb
View
@@ -828,13 +828,14 @@ class Application
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,
}
Please sign in to comment.
Something went wrong with that request. Please try again.