Skip to content
Browse files

Escaping square brackets in scan dir names.

  • Loading branch information...
1 parent 28a5014 commit fedc4e81f2c1d28780d028b27a17769ce31d8c43 @stever stever committed with Dec 20, 2009
Showing with 2 additions and 2 deletions.
  1. +2 −2 playdar_modules/library/src/scanner.erl
View
4 playdar_modules/library/src/scanner.erl
@@ -29,7 +29,7 @@ init([LibPid]) ->
handle_call({scan_dir, Dir}, From, State) ->
spawn(fun()->
- Resp = (catch scan(filelib:wildcard(Dir ++ "/*"), State#state.self)),
+ Resp = (catch scan(filelib:wildcard(re:replace(re:replace(Dir,"\\]","[]]",[{return,list}]),"\\[","[[]",[{return,list}]) ++ "/*"), State#state.self)),
library_dets:sync(State#state.libpid),
gen_server:reply(From, Resp)
end),
@@ -91,7 +91,7 @@ scan([], _Pid) -> ok;
scan([H|T], Pid) ->
?LOG(info, "Scan(~s)", [H]),
case filelib:is_dir(H) of
- true -> scan(filelib:wildcard(H ++ "/*"), Pid);
+ true -> scan(filelib:wildcard(re:replace(re:replace(H,"\\]","[]]",[{return,list}]),"\\[","[[]",[{return,list}]) ++ "/*"), Pid);
false ->
case ?MODULE:scan_file(Pid, H) of
ok-> ok;

0 comments on commit fedc4e8

Please sign in to comment.
Something went wrong with that request. Please try again.