Skip to content

Commit

Permalink
Fix misuse of sys.fpath()
Browse files Browse the repository at this point in the history
  • Loading branch information
szym committed Mar 5, 2016
1 parent 3ea4e79 commit d054497
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
-- Serves files from /static otherwise.

local async = require('async')
local paths = require('paths')
local sys = require('sys')

local function getMime(ext)
Expand Down Expand Up @@ -57,7 +58,7 @@ local function handler(req, res, client)
local ext = string.match(path, "%.%l%l%l?")
local mime = getMime(ext)

local file = io.open(sys.fpath() .. '/static' .. path, 'r')
local file = io.open(paths.dirname(sys.fpath()) .. '/static' .. path, 'r')
if file ~= nil then
local content = file:read("*all")
file:close()
Expand Down

0 comments on commit d054497

Please sign in to comment.