definition:
|
addExtension :: FilePath -> String -> FilePath
addExtension file [] = file
addExtension file xs@(x:_) = joinDrive a res
where
res = if isExtSeparator x then b ++ xs
else b ++ [extSeparator] ++ xs
(a,b) = splitDrive file
|
demand:
|
arguments 1 2
|
deterministic:
|
deterministic operation
|
documentation:
|
-- | Add an extension, even if there is already one there.
-- E.g. @addExtension \"foo.txt\" \"bat\" -> \"foo.txt.bat\"@.
--
-- > addExtension "file.txt" "bib" == "file.txt.bib"
-- > addExtension "file." ".bib" == "file..bib"
-- > addExtension "file" ".bib" == "file.bib"
-- > addExtension "/" "x" == "/.x"
-- > Valid x => takeFileName (addExtension (addTrailingPathSeparator x) "ext") == ".ext"
-- > Windows: addExtension "\\\\share" ".txt" == "\\\\share\\.txt"
|
failfree:
|
(_, _)
|
indeterministic:
|
referentially transparent operation
|
infix:
|
no fixity defined
|
iotype:
|
{(_,{[]}) |-> _ || (_,{:}) |-> _}
|
name:
|
addExtension
|
precedence:
|
no precedence defined
|
result-values:
|
_
|
signature:
|
String -> String -> String
|
solution-complete:
|
operation might suspend on free variables
|
terminating:
|
possibly non-terminating
|
totally-defined:
|
possibly non-reducible on same data term
|