Use System.FilePath.Posix instead of our own implementation
This commit is contained in:
parent
3f3467cc44
commit
f3cd0fa676
@ -62,7 +62,6 @@ executable Gtk
|
|||||||
Parser.PathParser
|
Parser.PathParser
|
||||||
Parser.Meshparser
|
Parser.Meshparser
|
||||||
Parser.Core
|
Parser.Core
|
||||||
System.FileSystem.FileExt
|
|
||||||
Algebra.Vector
|
Algebra.Vector
|
||||||
Algorithms.ConvexHull.GrahamScan
|
Algorithms.ConvexHull.GrahamScan
|
||||||
QueueEx
|
QueueEx
|
||||||
@ -86,6 +85,7 @@ executable Gtk
|
|||||||
safe >= 0.3.8,
|
safe >= 0.3.8,
|
||||||
containers >= 0.5.0.0,
|
containers >= 0.5.0.0,
|
||||||
diagrams-contrib >= 1.1.2.1
|
diagrams-contrib >= 1.1.2.1
|
||||||
|
filepath >= 1.3.0.2
|
||||||
|
|
||||||
-- Directories containing source files.
|
-- Directories containing source files.
|
||||||
-- hs-source-dirs:
|
-- hs-source-dirs:
|
||||||
@ -106,7 +106,6 @@ executable Gif
|
|||||||
Parser.PathParser
|
Parser.PathParser
|
||||||
Parser.Meshparser
|
Parser.Meshparser
|
||||||
Parser.Core
|
Parser.Core
|
||||||
System.FileSystem.FileExt
|
|
||||||
Algebra.Vector
|
Algebra.Vector
|
||||||
Algorithms.ConvexHull.GrahamScan
|
Algorithms.ConvexHull.GrahamScan
|
||||||
QueueEx
|
QueueEx
|
||||||
|
@ -14,7 +14,7 @@ import Graphics.UI.Gtk
|
|||||||
import Graphics.UI.Gtk.Glade
|
import Graphics.UI.Gtk.Glade
|
||||||
import MyPrelude
|
import MyPrelude
|
||||||
import System.Directory
|
import System.Directory
|
||||||
import System.FileSystem.FileExt
|
import System.FilePath.Posix
|
||||||
import Text.Read
|
import Text.Read
|
||||||
|
|
||||||
|
|
||||||
@ -231,7 +231,7 @@ saveAndDrawDiag :: FilePath -- ^ obj file to parse
|
|||||||
-> MyGUI
|
-> MyGUI
|
||||||
-> IO Int
|
-> IO Int
|
||||||
saveAndDrawDiag fp fps mygui =
|
saveAndDrawDiag fp fps mygui =
|
||||||
if cmpExt "obj" fp
|
if (==) ".obj" . takeExtension $ fp
|
||||||
then do
|
then do
|
||||||
mesh <- readFile fp
|
mesh <- readFile fp
|
||||||
mainDrawWindow <- widgetGetDrawWindow (mainDraw mygui)
|
mainDrawWindow <- widgetGetDrawWindow (mainDraw mygui)
|
||||||
|
@ -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 (== '.')
|
|
Loading…
Reference in New Issue
Block a user