Current section
Files
Jump to
Current section
Files
src/parrot@internal@project.erl
-module(parrot@internal@project).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([root/0, src/0]).
-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/parrot/internal/project.gleam", 16).
?DOC(false).
-spec find_root(binary()) -> binary().
find_root(Path) ->
Toml = filepath:join(Path, <<"gleam.toml"/utf8>>),
case simplifile_erl:is_file(Toml) of
{ok, false} ->
find_root(filepath:join(<<".."/utf8>>, Path));
{error, _} ->
find_root(filepath:join(<<".."/utf8>>, Path));
{ok, true} ->
Path
end.
-file("src/parrot/internal/project.gleam", 8).
?DOC(false).
-spec root() -> binary().
root() ->
find_root(<<"."/utf8>>).
-file("src/parrot/internal/project.gleam", 12).
?DOC(false).
-spec src() -> binary().
src() ->
filepath:join(root(), <<"src"/utf8>>).