[erlang-questions] Current working directory

Adam Lindberg adam@REDACTED
Wed Apr 16 09:39:53 CEST 2008


Yes, using that one is not "abuse". :-)

Although I'll stick with my version because it's more easily combined:

CurrentDirName = filename:basename(filename:absname("").

vs

{ok, Dir} = file:get_cwd(),
CurrentDirName = filename:basename(Dir).

Cheers!
Adam

--
Adam Lindberg
http://www.erlang-consulting.com

On Wed, Apr 16, 2008 at 9:15 AM, Ulf Wiger (TN/EAB)
<ulf.wiger@REDACTED> wrote:
> Adam Lindberg skrev:
>
>
> > Sorry, I was too hasty! It just came to me after sending the email:
> >
> > 1> filename:absname("").
> > "/home/alind"
> > 2>
> >
> > But it was not that intuitive. ;-)
> >
>
>  Then, perhaps this one will appeal to you more:
>
>   file:get_cwd() -> {ok, Dir} | {error, Reason}
>
>  BR,
>  Ulf W
>



More information about the erlang-questions mailing list