nitrogen / simple_bridge

A simple, standardized interface library to Erlang HTTP Servers.
MIT License
112 stars 76 forks source link

DIR of temporary files is not created #75

Open JiffB opened 2 years ago

JiffB commented 2 years ago

Hi Jesse,

As this DIR isn't created (latest git), a call to wf_pandoc(…) fails with this error :

/var/tmp/scratch/tempfile_9999999999999999 openBinaryFile: does not exist (No such file or directory)

The following diffs are fixing that.   Move the scratch dir from "./scratch" (bad, where does it go?) to "/var/tmp/scratch" (good, well identified) into: etc/simple_bridge.config

diff etc/simple_bridge.config_ORG etc/simple_bridge.config
45c45,46
<         {scratch_dir, "./scratch"}
---
> %%%%%%        {scratch_dir, "./scratch"}
>         {scratch_dir, "/var/tmp/scratch"}

BTW, there are a lot of useless space characters at the end of some lines in this file.   Check if the scratch DIR exist and if not, create it into: lib/simple_bridge/src/simple_bridge_util.erl

diff simple_bridge_util.erl_ORG simple_bridge_util.erl
113c113,119
<         Other -> Other
---
>         %%%Other -> Other
>         Other ->
>             % +1 L: the DIR of temporaries is not auto-created, do it
>             %       otherwise a wf_pandoc(…) call will fail with :
>             %       openBinaryFile: does not exist (No such file or directory)
>             ok = filelib:ensure_dir(Other ++ "/"),
>             Other

Jean-Yves