Skip to content
This repository has been archived by the owner on Jul 12, 2020. It is now read-only.

Commit

Permalink
Fixing minimal bug
Browse files Browse the repository at this point in the history
  • Loading branch information
David Baumgartner committed Oct 1, 2013
1 parent 560912e commit a6b0409
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions runserver.hs
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ toParams :: (String, String, String, String, String, String, String, String, Str
toParams (id_, cname, message, author, date, age, log_, files, lines_) = [("id",id_),("cname", cname), ("message", message), ("author", author), ("date", date), ("age", age), ("log", log_), ("files", files), ("lines", lines_)]


getDirectoryContentsWithIsDirectory :: String -> String -> IO [(String, Bool)]
getDirectoryContentsWithIsDirectory r a = ((getDirectoryContents a) >>= \dc -> (mapM isDir (filter (\a -> a /= "_darcs" && a !! 0 /= '.') dc)))
getDirectoryContentsWithIsDirectory :: String -> String -> String -> IO [(String, Bool)]
getDirectoryContentsWithIsDirectory r p a = ((getDirectoryContents a) >>= \dc -> (mapM isDir (filter (\a -> a /= "_darcs" && a !! 0 /= '.') dc)))
where
isDir :: String -> IO (String, Bool)
isDir b = do
fs <- getFileStatus $ rn ((gr r) ++ "/" ++ b)
fs <- getFileStatus $ rn ((gr r) ++ "/" ++ p ++ "/" ++ b)
return (b, isDirectory fs)


Expand Down Expand Up @@ -136,7 +136,7 @@ getTree params = basicViewIO (do
let path = ((rn $ gr $ readGet "n" params) ++ "/" ++ readGet "p" params)
fs <- getFileStatus path
fl <- (if isDirectory fs then do
dl <- (getDirectoryContentsWithIsDirectory (readGet "n" params) path)
dl <- (getDirectoryContentsWithIsDirectory (readGet "n" params) (readGet "p" params) path)
fl <- renderFile [("slug", readGet "n" params), ("repo", gr $ readGet "n" params)] [("files", (map (\a -> [("name", fst a), ("file", (readGet "p" params)++"/"++(fst a)), ("after", if (snd a) then ("/") else (" (<a href=\"/download/?n={{ slug }}&f="++(readGet "p" params)++"/"++(fst a)++"\" title=\"If not responding, click here.\">download</a>)"))]) dl))] "templates/tree.html"
return fl
else do
Expand Down

0 comments on commit a6b0409

Please sign in to comment.