Skip to content

Commit b76cd38

Browse files
Fix on conflict error
1 parent f6b2bc7 commit b76cd38

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/elixir/lib/file.ex

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ defmodule File do
981981
end
982982
end
983983

984-
@doc """
984+
@doc ~S"""
985985
Copies the contents of `source_file` to `destination_file` preserving its modes.
986986
987987
`source_file` must be a file or a symbolic link to one. `destination_file` must
@@ -1005,7 +1005,7 @@ defmodule File do
10051005
File.cp("hello.txt", "hello_copy.txt")
10061006
#=> :ok
10071007
1008-
File.cp("hello.txt", "hello_copy.txt", fn source, destination ->
1008+
File.cp("hello.txt", "hello_copy.txt", on_conflict: fn source, destination ->
10091009
IO.gets("Overwriting #{destination} by #{source}. Type y to confirm. ") == "y\n"
10101010
end)
10111011
#=> :ok
@@ -1056,7 +1056,7 @@ defmodule File do
10561056
Path.expand(p1) !== Path.expand(p2)
10571057
end
10581058

1059-
@doc """
1059+
@doc ~S"""
10601060
The same as `cp/3`, but raises a `File.CopyError` exception if it fails.
10611061
Returns `:ok` otherwise.
10621062
@@ -1065,14 +1065,13 @@ defmodule File do
10651065
File.cp!("hello.txt", "hello_copy.txt")
10661066
#=> :ok
10671067
1068-
File.cp!("hello.txt", "hello_copy.txt", fn source, destination ->
1068+
File.cp!("hello.txt", "hello_copy.txt", on_conflict: fn source, destination ->
10691069
IO.gets("Overwriting #{destination} by #{source}. Type y to confirm. ") == "y\n"
10701070
end)
10711071
#=> :ok
10721072
10731073
File.cp!("non_existing.txt", "copy.txt")
10741074
** (File.CopyError) could not copy from "non_existing.txt" to "copy.txt": no such file or directory
1075-
10761075
"""
10771076
@spec cp!(Path.t(), Path.t(), on_conflict: on_conflict_callback) :: :ok
10781077
def cp!(source_file, destination_file, options \\ []) do

0 commit comments

Comments
 (0)