Skip to content

Commit

Permalink
copy_dir: fix for empty dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
AltGr committed Sep 16, 2016
1 parent 01ab839 commit 3d8be44
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
24 changes: 12 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,20 @@ opam-%.install:
$(MAKE) -C src ../opam-$*.install

opam.install:
echo 'bin: [' >$@
echo ' "src/opam"' >>$@
echo ' "src/opam-admin"' >>$@
echo ' "src/opam-installer"' >>$@
echo ']' >>$@
echo 'man: [' >>$@
$(patsubst %,echo ' "'%'"' >>$@;,$(wildcard doc/man/*.1))
echo ']' >>$@
echo 'doc: [' >>$@
$(foreach x,$(wildcard doc/man-html/*.html),\
@echo 'bin: [' >$@
@echo ' "src/opam"' >>$@
@echo ' "src/opam-admin"' >>$@
@echo ' "src/opam-installer"' >>$@
@echo ']' >>$@
@echo 'man: [' >>$@
@$(patsubst %,echo ' "'%'"' >>$@;,$(wildcard doc/man/*.1))
@echo ']' >>$@
@echo 'doc: [' >>$@
@$(foreach x,$(wildcard doc/man-html/*.html),\
echo ' "$x" {"man/$(notdir $x)"}' >>$@;)
$(foreach x,$(wildcard doc/pages/*.html),\
@$(foreach x,$(wildcard doc/pages/*.html),\
echo ' "$x" {"$(notdir $x)"}' >>$@;)
echo ']' >>$@
@echo ']' >>$@

opam-devel.install:
@echo 'libexec: [' >$@
Expand Down
7 changes: 5 additions & 2 deletions src/core/opamSystem.ml
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,11 @@ let copy_file src dst =
let copy_dir src dst =
if Sys.file_exists dst then
if Sys.is_directory dst then
command ~verbose:(verbose_for_base_commands ())
([ "cp"; "-PR" ] @ ls src @ [ dst ])
match ls src with
| [] -> ()
| srcfiles ->
command ~verbose:(verbose_for_base_commands ())
([ "cp"; "-PR" ] @ srcfiles @ [ dst ])
else internal_error "Can not copy dir %s to %s, which is not a directory"
src dst
else
Expand Down

0 comments on commit 3d8be44

Please sign in to comment.