-module(sketch_css@path). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -define(FILEPATH, "src/sketch_css/path.gleam"). -export([dirname/1, join/2]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. ?MODULEDOC(false). -file("src/sketch_css/path.gleam", 15). ?DOC(false). -spec dirname(binary()) -> {ok, binary()} | {error, snag:snag()}. dirname(Path) -> gleam@result:map( begin _pipe = simplifile_erl:is_file(Path), _pipe@1 = snag:map_error(_pipe, fun gleam@string:inspect/1), snag:context(_pipe@1, <<"Impossible to detect file"/utf8>>) end, fun(Is_file) -> gleam@bool:guard(not Is_file, Path, fun() -> _pipe@2 = Path, _pipe@3 = gleam@string:split(_pipe@2, <<"/"/utf8>>), _pipe@4 = lists:reverse(_pipe@3), _pipe@5 = gleam@list:drop(_pipe@4, 1), _pipe@6 = lists:reverse(_pipe@5), gleam@string:join(_pipe@6, <<"/"/utf8>>) end) end ). -file("src/sketch_css/path.gleam", 31). ?DOC(false). -spec join(binary(), binary()) -> binary(). join(Path, Segment) -> _pipe = [Path, Segment], _pipe@1 = gleam@string:join(_pipe, <<"/"/utf8>>), gleam@string:replace(_pipe@1, <<"//"/utf8>>, <<"/"/utf8>>).