Use System.FilePath.Posix instead of our own implementation

This commit is contained in:
hasufell 2014-11-16 00:25:17 +01:00
parent 3f3467cc44
commit f3cd0fa676
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
3 changed files with 3 additions and 30 deletions

View File

@ -62,7 +62,6 @@ executable Gtk
Parser.PathParser
Parser.Meshparser
Parser.Core
System.FileSystem.FileExt
Algebra.Vector
Algorithms.ConvexHull.GrahamScan
QueueEx
@ -86,6 +85,7 @@ executable Gtk
safe >= 0.3.8,
containers >= 0.5.0.0,
diagrams-contrib >= 1.1.2.1
filepath >= 1.3.0.2
-- Directories containing source files.
-- hs-source-dirs:
@ -106,7 +106,6 @@ executable Gif
Parser.PathParser
Parser.Meshparser
Parser.Core
System.FileSystem.FileExt
Algebra.Vector
Algorithms.ConvexHull.GrahamScan
QueueEx

View File

@ -14,7 +14,7 @@ import Graphics.UI.Gtk
import Graphics.UI.Gtk.Glade
import MyPrelude
import System.Directory
import System.FileSystem.FileExt
import System.FilePath.Posix
import Text.Read
@ -231,7 +231,7 @@ saveAndDrawDiag :: FilePath -- ^ obj file to parse
-> MyGUI
-> IO Int
saveAndDrawDiag fp fps mygui =
if cmpExt "obj" fp
if (==) ".obj" . takeExtension $ fp
then do
mesh <- readFile fp
mainDrawWindow <- widgetGetDrawWindow (mainDraw mygui)

View File

@ -1,26 +0,0 @@
{-# OPTIONS_HADDOCK ignore-exports #-}
module System.FileSystem.FileExt where
import MyPrelude
-- |Compare the extension of a file with the given String.
cmpExt :: String -> FilePath -> Bool
cmpExt checkExt = (==) checkExt . getExt
-- |Get the extension of a file.
getExt :: FilePath -> String
getExt fp
| hasExt fp = last .
splitBy (== '.') .
last .
splitBy (== '/') $
fp
| otherwise = ""
-- |Check if the file has an extension.
hasExt :: FilePath -> Bool
hasExt = (>1) . length . splitBy (== '.')