Current section

Files

Jump to
spectator src spectator@internal@common.erl
Raw

src/spectator@internal@common.erl

-module(spectator@internal@common).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([static_file/1]).
-file("/Users/jonas/Projects/spectator/src/spectator/internal/common.gleam", 8).
-spec static_file(binary()) -> binary().
static_file(Name) ->
_assert_subject = gleam_erlang_ffi:priv_directory(<<"spectator"/utf8>>),
{ok, Priv} = case _assert_subject of
{ok, _} -> _assert_subject;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail,
module => <<"spectator/internal/common"/utf8>>,
function => <<"static_file"/utf8>>,
line => 9})
end,
_assert_subject@1 = simplifile:read(
<<<<Priv/binary, "/"/utf8>>/binary, Name/binary>>
),
{ok, Data} = case _assert_subject@1 of
{ok, _} -> _assert_subject@1;
_assert_fail@1 ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail@1,
module => <<"spectator/internal/common"/utf8>>,
function => <<"static_file"/utf8>>,
line => 10})
end,
Data.