Skip to content

Commit

Permalink
RFCT Cleanup imports
Browse files Browse the repository at this point in the history
  • Loading branch information
luispedro committed Jan 9, 2019
1 parent 3db834a commit 8d978f2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions NGLess/FileManagement.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ module FileManagement
, openNGLTempFile
, openNGLTempFile'
, makeNGLTempFile
, removeFileIfExists
, removeIfTemporary
, setupHtmlViewer
, takeBaseNameNoExtensions
Expand All @@ -28,12 +27,12 @@ import qualified Data.ByteString.Lazy as BL
import qualified Codec.Archive.Tar as Tar
import qualified Codec.Archive.Tar.Entry as Tar
import qualified Codec.Compression.GZip as GZip
import Text.RE.TDFA.String
import qualified Text.RE.TDFA.String as RE
import Data.List (isPrefixOf)
import System.FilePath
import Control.Monad
import System.Posix.Files (setFileMode)
import System.Posix.Internals (c_getpid)
import System.FilePath (dropExtensions, takeBaseName, takeDirectory, (</>), (<.>))
import Control.Monad (unless, forM_, when)
import System.Posix.Files (setFileMode)
import System.Posix.Internals (c_getpid)

import System.Directory
import System.IO
Expand Down Expand Up @@ -126,6 +125,7 @@ removeIfTemporary fp = do
outputListLno' DebugOutput ["Removing temporary file: ", fp]
liftIO $ removeFileIfExists fp
updateNglEnvironment $ \e -> e { ngleTemporaryFilesCreated = filter (/=fp) (ngleTemporaryFilesCreated e) }
{-# NOINLINE removeIfTemporary #-}


-- | This is a version of 'takeBaseName' which drops all extension
Expand Down Expand Up @@ -332,7 +332,7 @@ expandPath fbase = do
val -> return val

expandPath' :: FilePath -> [FilePath] -> [FilePath]
expandPath' fbase search = case matchedText $ fbase ?=~ [re|<(@{%id})?>|] of
expandPath' fbase search = case RE.matchedText $ fbase RE.?=~ [RE.re|<(@{%id})?>|] of
Nothing -> [fbase]
Just c -> mapMaybe (expandPath'' $ trim c) search
where
Expand All @@ -344,7 +344,7 @@ expandPath' fbase search = case matchedText $ fbase ?=~ [re|<(@{%id})?>|] of
| '=' `notElem` path = Just path
| (c++"=")`isPrefixOf` path = Just $ drop (length c + 1) path
| otherwise = Nothing
fbase' = removeSlash1 $ fbase *=~/ [ed|<(@{%id})?>///|]
fbase' = removeSlash1 $ fbase RE.*=~/ [RE.ed|<(@{%id})?>///|]
removeSlash1 "" = ""
removeSlash1 ('/':p) = removeSlash1 p
removeSlash1 p = p
Expand Down

0 comments on commit 8d978f2

Please sign in to comment.