A music player that connects to your cloud/distributed storage. diffuse.sh
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849module String.Path exposing (..)
import List.Extra as List
-- ⛩
sep : Stringsep = "/"
-- 🔱
addSuffix : String -> StringaddSuffix path = case path of "" -> ""
p -> p ++ sep
{-| Drop an amount of path segments from the right side.
>>> dropRight 5 "a/b/c/d/e/f" "a"
-}dropRight : Int -> String -> StringdropRight int path = path |> String.split sep |> (\l -> List.take (List.length l - int) l) |> String.join sep
file : String -> Stringfile path = path |> String.split sep |> List.last |> Maybe.withDefault path