use intercalate instead of MissingH's join
The two functions are identical.
This commit is contained in:
parent
689bdae03a
commit
04e150abb3
4 changed files with 8 additions and 6 deletions
|
@ -29,6 +29,7 @@ import System.IO.Unsafe
|
||||||
import qualified Data.Hash.MD5 as MD5
|
import qualified Data.Hash.MD5 as MD5
|
||||||
import Data.Word
|
import Data.Word
|
||||||
import Data.Bits.Utils
|
import Data.Bits.Utils
|
||||||
|
import Data.List
|
||||||
import Data.List.Utils
|
import Data.List.Utils
|
||||||
import qualified Data.ByteString.Lazy as L
|
import qualified Data.ByteString.Lazy as L
|
||||||
#ifdef mingw32_HOST_OS
|
#ifdef mingw32_HOST_OS
|
||||||
|
@ -125,12 +126,12 @@ decodeW8 = s2w8 . _encodeFilePath
|
||||||
|
|
||||||
{- Like encodeW8 and decodeW8, but NULs are passed through unchanged. -}
|
{- Like encodeW8 and decodeW8, but NULs are passed through unchanged. -}
|
||||||
encodeW8NUL :: [Word8] -> FilePath
|
encodeW8NUL :: [Word8] -> FilePath
|
||||||
encodeW8NUL = join nul . map encodeW8 . split (s2w8 nul)
|
encodeW8NUL = intercalate nul . map encodeW8 . split (s2w8 nul)
|
||||||
where
|
where
|
||||||
nul = ['\NUL']
|
nul = ['\NUL']
|
||||||
|
|
||||||
decodeW8NUL :: FilePath -> [Word8]
|
decodeW8NUL :: FilePath -> [Word8]
|
||||||
decodeW8NUL = join (s2w8 nul) . map decodeW8 . split nul
|
decodeW8NUL = intercalate (s2w8 nul) . map decodeW8 . split nul
|
||||||
where
|
where
|
||||||
nul = ['\NUL']
|
nul = ['\NUL']
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ toString (ListV l)
|
||||||
| null l = ""
|
| null l = ""
|
||||||
| otherwise = (intercalate ";" $ map (escapesemi . toString) l) ++ ";"
|
| otherwise = (intercalate ";" $ map (escapesemi . toString) l) ++ ";"
|
||||||
where
|
where
|
||||||
escapesemi = join "\\;" . split ";"
|
escapesemi = intercalate "\\;" . split ";"
|
||||||
|
|
||||||
genDesktopEntry :: String -> String -> Bool -> FilePath -> Maybe String -> [String] -> DesktopEntry
|
genDesktopEntry :: String -> String -> Bool -> FilePath -> Maybe String -> [String] -> DesktopEntry
|
||||||
genDesktopEntry name comment terminal program icon categories = catMaybes
|
genDesktopEntry name comment terminal program icon categories = catMaybes
|
||||||
|
|
|
@ -89,7 +89,7 @@ parentDir = takeDirectory . dropTrailingPathSeparator
|
||||||
upFrom :: FilePath -> Maybe FilePath
|
upFrom :: FilePath -> Maybe FilePath
|
||||||
upFrom dir
|
upFrom dir
|
||||||
| length dirs < 2 = Nothing
|
| length dirs < 2 = Nothing
|
||||||
| otherwise = Just $ joinDrive drive (join s $ init dirs)
|
| otherwise = Just $ joinDrive drive (intercalate s $ init dirs)
|
||||||
where
|
where
|
||||||
-- on Unix, the drive will be "/" when the dir is absolute, otherwise ""
|
-- on Unix, the drive will be "/" when the dir is absolute, otherwise ""
|
||||||
(drive, path) = splitDrive dir
|
(drive, path) = splitDrive dir
|
||||||
|
@ -149,7 +149,7 @@ relPathDirToFile from to = relPathDirToFileAbs <$> absPath from <*> absPath to
|
||||||
relPathDirToFileAbs :: FilePath -> FilePath -> FilePath
|
relPathDirToFileAbs :: FilePath -> FilePath -> FilePath
|
||||||
relPathDirToFileAbs from to
|
relPathDirToFileAbs from to
|
||||||
| takeDrive from /= takeDrive to = to
|
| takeDrive from /= takeDrive to = to
|
||||||
| otherwise = join s $ dotdots ++ uncommon
|
| otherwise = intercalate s $ dotdots ++ uncommon
|
||||||
where
|
where
|
||||||
s = [pathSeparator]
|
s = [pathSeparator]
|
||||||
pfrom = split s from
|
pfrom = split s from
|
||||||
|
|
|
@ -14,6 +14,7 @@ import Utility.Process
|
||||||
import Data.String.Utils
|
import Data.String.Utils
|
||||||
import System.FilePath
|
import System.FilePath
|
||||||
import Data.Char
|
import Data.Char
|
||||||
|
import Data.List
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Prelude
|
import Prelude
|
||||||
|
|
||||||
|
@ -85,7 +86,7 @@ shellEscape :: String -> String
|
||||||
shellEscape f = "'" ++ escaped ++ "'"
|
shellEscape f = "'" ++ escaped ++ "'"
|
||||||
where
|
where
|
||||||
-- replace ' with '"'"'
|
-- replace ' with '"'"'
|
||||||
escaped = join "'\"'\"'" $ split "'" f
|
escaped = intercalate "'\"'\"'" $ split "'" f
|
||||||
|
|
||||||
-- | Unescapes a set of shellEscaped words or filenames.
|
-- | Unescapes a set of shellEscaped words or filenames.
|
||||||
shellUnEscape :: String -> [String]
|
shellUnEscape :: String -> [String]
|
||||||
|
|
Loading…
Reference in a new issue