5HT / fs

📁 FS: Windows, Linux, Mac Driver
https://fs.n2o.dev
Other
234 stars 69 forks source link

How to use FS with escript #50

Closed pmartinezalvarez closed 6 years ago

pmartinezalvarez commented 6 years ago

I am trying to use the library embedded on an escript on a Mac OS environment. The application works perfectly on iex, but when I run the generated escript the mad_repl module is not available.

error: GenServer #PID<0.172.0> terminating
** (UndefinedFunctionError) function :mad_repl.load_file/1 is undefined (module :mad_repl is not available)
    :mad_repl.load_file('deps/fs/priv/mac_listener')
    (fs) /Users/pablomartinez/Documents/development/workspaces/glayu/glayu/deps/fs/src/fs.erl:43: :fs.mad_file/1
    (fs) /Users/pablomartinez/Documents/development/workspaces/glayu/glayu/deps/fs/src/fs_sup.erl:27: :fs_sup.has_executable/1
    (fs) /Users/pablomartinez/Documents/development/workspaces/glayu/glayu/deps/fs/src/fs_sup.erl:17: :fs_sup.init/1
    (stdlib) supervisor.erl:294: :supervisor.init/1
    (stdlib) gen_server.erl:365: :gen_server.init_it/2
    (stdlib) gen_server.erl:333: :gen_server.init_it/6
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3

Is there a way to deal with it?

Thanks!

5HT commented 6 years ago

fs for sure needs to be working without mad: https://hex.pm/packages/mad But in escript you need to load mac_listener NIF, this is done with virtual ETS Filesystem which is accessed by mad in mad_repl:load_file. So I suggest you to plug mad into your project if you want to access mac_listener ebbedded in escript.

pmartinezalvarez commented 6 years ago

Thanks! solved after adding the mad dep.