@@ -45,6 +45,7 @@ defmodule ElixirScript do
4545 # This is the serialized state of the ElixirScript.State module containing references to the standard library
4646 @ external_resource stdlib_state_path = Path . join ( [ __DIR__ , "elixir_script" , "translator" , "stdlib_state.bin" ] )
4747 @ stdlib_state File . read! ( stdlib_state_path )
48+ @ lib_path Application . get_env ( :elixir_script , :lib_path )
4849
4950 @ doc """
5051 Compiles the given Elixir code string
@@ -71,6 +72,7 @@ defmodule ElixirScript do
7172 @ spec compile_path ( binary , Map . t ) :: [ binary | { binary , binary } | :ok ]
7273 def compile_path ( path , opts \\ % { } ) do
7374 expanded_path = Path . wildcard ( path )
75+ opts = build_compiler_options ( opts )
7476
7577 compiler_cache = get_compiler_cache ( path , opts )
7678
@@ -335,14 +337,20 @@ end
335337 #Gets path to js files whether the mix project is available
336338 #or when used as an escript
337339 defp operating_path do
338- try do
339- Mix.Project . build_path <> "/lib/elixir_script/priv"
340- rescue
341- UndefinedFunctionError ->
342- split_path = Path . split ( Application . app_dir ( :elixirscript ) )
343- replaced_path = List . delete_at ( split_path , length ( split_path ) - 1 )
344- replaced_path = List . delete_at ( replaced_path , length ( replaced_path ) - 1 )
345- Path . join ( replaced_path )
340+ case @ lib_path do
341+ nil ->
342+ try do
343+ Mix.Project . build_path <> "/lib/elixir_script/priv"
344+ rescue
345+ UndefinedFunctionError ->
346+ split_path = Path . split ( Application . app_dir ( :elixirscript ) )
347+ replaced_path = List . delete_at ( split_path , length ( split_path ) - 1 )
348+ replaced_path = List . delete_at ( replaced_path , length ( replaced_path ) - 1 )
349+ Path . join ( replaced_path )
350+ end
351+ lib_path ->
352+ lib_path
346353 end
347354 end
355+
348356end
0 commit comments