From cf5faeb3fe8f1d04c06b0cea74198601736dbe9c Mon Sep 17 00:00:00 2001 From: Louis-Guillaume Gagnon Date: Thu, 5 Sep 2013 19:18:59 -0400 Subject: [PATCH] Filter.hs: Fix the relative path problem (use canonicalizePath) --- src/Tools/Filter.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Tools/Filter.hs b/src/Tools/Filter.hs index 13c5b5a..a97fd24 100644 --- a/src/Tools/Filter.hs +++ b/src/Tools/Filter.hs @@ -32,7 +32,7 @@ module Tools.Filter ( import Data.Char (isDigit) import Data.List (intersect,intersperse,(\\)) -import System.Directory (doesFileExist, getCurrentDirectory) +import System.Directory (canonicalizePath,doesFileExist) data Filter = File String | Title String @@ -77,9 +77,9 @@ checkFile fs = case filter isPathFilter fs of [] -> return $ Right "" ((File p):_) -> do exists <- doesFileExist p if exists - then do cd <- getCurrentDirectory - return $ Right $ cd ++ "/" ++ p - else do return $ Left $ "File does not exists: " ++ p + then do path <- canonicalizePath p + return $ Right path + else return $ Left $ "File does not exists: " ++ p isFilter :: String -> Bool isFilter f = f `elem` ["-f","-t","-a","-k","-j","-v","-y","-p"] -- 2.11.4.GIT