From 55b40bf0b65a4bec7c0000e39ddba03e6a77bf44 Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Thu, 3 Nov 2011 11:39:58 +0100 Subject: [PATCH] Seperate static dir from template dir. --- stoptime.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/stoptime.rb b/stoptime.rb index bb9c803..4f7d6c4 100644 --- a/stoptime.rb +++ b/stoptime.rb @@ -19,8 +19,9 @@ require "pathname" Markaby::Builder.set(:indent, 2) Camping.goes :StopTime -unless defined? BASE_DIR - BASE_DIR = Pathname.new(__FILE__).dirname.expand_path + "public" +unless defined? PUBLIC_DIR + PUBLIC_DIR = Pathname.new(__FILE__).dirname.expand_path + "public" + TEMPLATE_DIR = Pathname.new(__FILE__).dirname.expand_path + "templates" # Set the default date(/time) format. ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!( @@ -261,7 +262,7 @@ module StopTime::Controllers mime_type = MIME::Types.type_for(path).first @headers['Content-Type'] = mime_type.nil? ? "text/plain" : mime_type.to_s unless path.include? ".." - @headers['X-Sendfile'] = (BASE_DIR + path).to_s + @headers['X-Sendfile'] = (PUBLIC_DIR + path).to_s else @status = "403" "Error 403: Invalid path: #{path}"