+-- Write the output files.
+
+splitName :: String -> (String, String)
+splitName name =
+ case break (== '/') name of
+ (file, []) -> ([], file)
+ (dir, sep:rest) -> (dir++sep:restDir, restFile)
+ where
+ (restDir, restFile) = splitName rest
+
+splitExt :: String -> (String, String)
+splitExt name =
+ case break (== '.') name of
+ (base, []) -> (base, [])
+ (base, sepRest@(sep:rest))
+ | null restExt -> (base, sepRest)
+ | otherwise -> (base++sep:restBase, restExt)
+ where
+ (restBase, restExt) = splitExt rest