[erlang-questions] file:list_dir/1 mystery

Robert Raschke rtrlists@REDACTED
Tue Dec 6 23:53:03 CET 2016


Hi Lloyd,

In the bash examples your paths start with /home/lloyd/EG , whereas your
erl examples start with /home/lloyd/Erlang

Could that be it?

Hth,
Robby

On 6 Dec 2016 19:59, <lloyd@REDACTED> wrote:

> Hello,
>
> Working with a fork of erlguten, I created an image directory under priv
> today but file:list_dir/1 can't find it.
>
> Bash sees it:
>
> Test 1:
>
> lloyd@REDACTED:~/EG/erlguten/priv$ ls -l
> total 20
> -rw-rw-r-- 1 lloyd lloyd  179 Nov  1 16:45 font_locations
> drwxrwxr-x 5 lloyd lloyd 4096 Nov  1 16:45 fonts
> drwxrwxr-x 3 lloyd lloyd 4096 Nov  1 16:45 hyphenation
> drwxrwxr-x 2 lloyd lloyd 4096 Dec  3 14:12 images
> drwxrwxr-x 2 lloyd lloyd 4096 Nov  1 16:45 src
>
> Test 2:
>
> lloyd@REDACTED:~/EG/erlguten/priv$ cd /home/lloyd/EG/erlguten/priv/images
> lloyd@REDACTED:~/EG/erlguten/priv/images$ ls -l
> total 52
> -rw-rw-r-- 1 lloyd lloyd 52820 Dec  3 14:12 book_cover.jpg
>
> But but file:list_dir/1 doesn't:
>
> 1> Priv = code:priv_dir(erlguten).
> "/home/lloyd/Erlang/erlguten/priv"
> 2>
> 2> Images = Priv ++ "/images".
> "/home/lloyd/Erlang/erlguten/priv/images"
> 3>
> 3> file:list_dir(Priv).
> {ok,["hyphenation","font_locations","fonts","src"]}
> 4>
> 4> file:list_dir(Images).
> {error,enoent}
>
> Note: erl started with
>
> lloyd@REDACTED:~/EG/erlguten$ -pa ebin -pa lib/*/ebin
>
> Here's the bash listing for ~/EG/erlguten:
>
> lloyd@REDACTED:~/EG/erlguten$ ls -l
> total 260
> -rw-rw-r--  1 lloyd lloyd  17376 Nov  1 18:48 comcast_bill.pdf
> drwxrwxr-x  2 lloyd lloyd   4096 Nov  2 19:10 deps
> drwxrwxr-x  2 lloyd lloyd   4096 Nov  1 16:45 doc
> drwxrwxr-x  2 lloyd lloyd   4096 Nov 29 17:12 ebin
> drwxrwxr-x  2 lloyd lloyd   4096 Nov 30 18:31 include
> -rw-rw-r--  1 lloyd lloyd     32 Nov  1 16:45 install.mk
> drwxrwxr-x  3 lloyd lloyd   4096 Nov  1 17:42 lib
> -rw-rw-r--  1 lloyd lloyd   1157 Nov  1 16:45 LICENSE
> -rw-rw-r--  1 lloyd lloyd    206 Nov  1 16:45 Makefile
> drwxrwxr-x  6 lloyd lloyd   4096 Dec  6 12:47 priv
> -rw-rw-r--  1 lloyd lloyd   7208 Nov  1 16:45 readme.md
> -rwxrwxr-x  1 lloyd lloyd 175879 Nov  2 16:56 rebar
> -rw-rw-r--  1 lloyd lloyd    201 Nov  1 17:42 rebar.config
> drwxrwxr-x 11 lloyd lloyd   4096 Dec  2 16:19 src
> drwxrwxr-x  4 lloyd lloyd   4096 Nov 30 18:28 test
>
> I've tried rebooting, but that doesn't solve the problem.
>
> Are my aging eyes missing something? Or my aging brain overlooking
> something obvious?
>
> In short, how can I return images to my application?
>
> Many thanks,
>
> LRP
>
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20161206/3b8fb0df/attachment.htm>


More information about the erlang-questions mailing list