Skip to content

Instantly share code, notes, and snippets.

@capflam
Created June 28, 2013 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save capflam/5887571 to your computer and use it in GitHub Desktop.
Save capflam/5887571 to your computer and use it in GitHub Desktop.
Yaws :: patch to create log directory if it doesn't exist
diff --git a/src/yaws_config.erl b/src/yaws_config.erl
index ed013c3..3b624dd 100644
--- a/src/yaws_config.erl
+++ b/src/yaws_config.erl
@@ -739,7 +739,15 @@ fload(FD, globals, GC, C, Cs, Lno, Chars) ->
["logdir", '=', Logdir] ->
- Dir = filename:absname(Logdir),
+ Dir = case Logdir of
+ "+" ++ D ->
+ D1 = filename:absname(D),
+ %% try to make the log directory if it doesn't exist
+ yaws:mkdir(D1),
+ D1;
+ _ ->
+ filename:absname(Logdir)
+ end,
case is_dir(Dir) of
true ->
put(logdir, Dir),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment