Skip to content

Commit f49b997

Browse files
committed
feat: use System.tmp_dir() rather than Mix.Project.build_path()
Useful when using protox in Livebook, as Mix.Project.build_path() returns an invalid path.
1 parent af8759f commit f49b997

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/protox.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ defmodule Protox do
241241
case Keyword.pop(opts, :schema) do
242242
{<<text::binary>>, opts} ->
243243
filename = "#{Base.encode16(:crypto.hash(:sha, text))}.proto"
244-
filepath = [Mix.Project.build_path(), filename] |> Path.join() |> Path.expand()
244+
filepath = [System.tmp_dir!(), filename] |> Path.join() |> Path.expand()
245245
File.write!(filepath, text)
246246
{[filepath], opts}
247247

lib/protox/protoc.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ defmodule Protox.Protoc do
2525

2626
defp do_run(proto_files, args) do
2727
outfile_name = "protox_#{random_string()}"
28-
outfile_path = Path.join([Mix.Project.build_path(), outfile_name])
28+
outfile_path = Path.join([System.tmp_dir!(), outfile_name])
2929

3030
cmd_args = ["--include_imports", "-o", outfile_path] ++ args ++ proto_files
3131

0 commit comments

Comments
 (0)