From 540c24f3a569eb6e68ae6170b67abfda87e64e99 Mon Sep 17 00:00:00 2001 From: Chris Done Date: Fri, 4 Mar 2016 14:49:21 +0100 Subject: [PATCH] Use FilePath.isValid (#12) --- src/Path.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Path.hs b/src/Path.hs index 3237bac..21c8829 100644 --- a/src/Path.hs +++ b/src/Path.hs @@ -97,7 +97,8 @@ parseAbsDir filepath = if FilePath.isAbsolute filepath && not (null (normalizeDir filepath)) && not ("~/" `isPrefixOf` filepath) && - not (hasParentDir filepath) + not (hasParentDir filepath) && + FilePath.isValid filepath then return (Path (normalizeDir filepath)) else throwM (InvalidAbsDir filepath) @@ -116,7 +117,8 @@ parseRelDir filepath = not ("~/" `isPrefixOf` filepath) && not (hasParentDir filepath) && not (null (normalizeDir filepath)) && - not (all (=='.') filepath) + not (all (== '.') filepath) && + FilePath.isValid filepath then return (Path (normalizeDir filepath)) else throwM (InvalidRelDir filepath) @@ -132,7 +134,8 @@ parseAbsFile filepath = not ("~/" `isPrefixOf` filepath) && not (hasParentDir filepath) && not (null (normalizeFile filepath)) && - not (all (=='.') filepath) + not (all (== '.') filepath) && + FilePath.isValid filepath then return (Path (normalizeFile filepath)) else throwM (InvalidAbsFile filepath) @@ -151,7 +154,8 @@ parseRelFile filepath = not ("~/" `isPrefixOf` filepath) && not (hasParentDir filepath) && not (null (normalizeFile filepath)) && - not (all (=='.') filepath) + not (all (== '.') filepath) && + FilePath.isValid filepath then return (Path (normalizeFile filepath)) else throwM (InvalidRelFile filepath)