Skip to content

Commit

Permalink
core: add z_media_archive:archive_delete/2
Browse files Browse the repository at this point in the history
  • Loading branch information
mworrell committed Mar 21, 2014
1 parent 20affcf commit e3a2f64
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/support/z_media_archive.erl
Expand Up @@ -32,6 +32,7 @@
archive_copy/3,
archive_copy_opt/2,
archive_copy_opt/3,
archive_delete/2,
archive_filename/2,
rel_archive/2,
safe_filename/1
Expand Down Expand Up @@ -79,7 +80,8 @@ archive_file(Filename, NewBasename, Context) ->
{error, exdev} ->
{ok, _BytesCopied} = file:copy(Fileabs, AbsPath),
ok = file:delete(Fileabs);
ok -> ok
ok ->
ok
end,
NewFile
end.
Expand Down Expand Up @@ -115,6 +117,12 @@ archive_copy_opt(Filename, NewBasename, Context) ->
rel_archive(Fileabs, Context)
end.

%% @doc Delete a filename in the archive
archive_delete(Filename, Context) ->
AbsPath = abspath(Filename, Context),
file:delete(AbsPath).


%% Return an unique filename for archiving the file
archive_filename(Filename, Context) ->
Archive = z_path:media_archive(Context),
Expand Down

0 comments on commit e3a2f64

Please sign in to comment.