Skip to content

Commit ccc6515

Browse files
authored
Restore binary compatible copy methods (#80)
Added os.copy.apply and os.copy.into.apply overloads to restore binary compatibility. Pull request: #80
1 parent 53c33bb commit ccc6515

File tree

1 file changed

+50
-1
lines changed

1 file changed

+50
-1
lines changed

os/src/FileOps.scala

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ object copy {
153153
def matching(partialFunction: PartialFunction[Path, Path]): PartialFunction[Path, Unit] = {
154154
matching()(partialFunction)
155155
}
156+
156157
def apply(
157158
from: Path,
158159
to: Path,
@@ -191,6 +192,26 @@ object copy {
191192
if (stat(from, followLinks = followLinks).isDir) walk(from).map(copyOne)
192193
}
193194

195+
/** This overload is only to keep binary compatibility with older os-lib versions. */
196+
@deprecated("Use os.copy(from, to, followLinks, replaceExisting, copyAttributes, " +
197+
"createFolders, mergeFolders) instead", "os-lib 0.7.5")
198+
def apply(
199+
from: Path,
200+
to: Path,
201+
followLinks: Boolean,
202+
replaceExisting: Boolean,
203+
copyAttributes: Boolean,
204+
createFolders: Boolean
205+
): Unit = apply(
206+
from = from,
207+
to = to,
208+
followLinks = followLinks,
209+
replaceExisting = replaceExisting,
210+
copyAttributes = copyAttributes,
211+
createFolders = createFolders,
212+
mergeFolders = false
213+
)
214+
194215
/**
195216
* Copy a file into a particular folder, rather
196217
* than into a particular path
@@ -208,6 +229,26 @@ object copy {
208229
followLinks, replaceExisting, copyAttributes, createFolders, mergeFolders
209230
)
210231
}
232+
233+
/** This overload is only to keep binary compatibility with older os-lib versions. */
234+
@deprecated("Use os.copy.into(from, to, followLinks, replaceExisting, copyAttributes, " +
235+
"createFolders, mergeFolders) instead", "os-lib 0.7.5")
236+
def apply(
237+
from: Path,
238+
to: Path,
239+
followLinks: Boolean,
240+
replaceExisting: Boolean,
241+
copyAttributes: Boolean,
242+
createFolders: Boolean
243+
): Unit = apply(
244+
from = from,
245+
to = to,
246+
followLinks = followLinks,
247+
replaceExisting = replaceExisting,
248+
copyAttributes = copyAttributes,
249+
createFolders = createFolders,
250+
mergeFolders = false
251+
)
211252
}
212253

213254
/**
@@ -222,7 +263,15 @@ object copy {
222263
copyAttributes: Boolean = false,
223264
createFolders: Boolean = false): Unit = {
224265
os.remove.all(to)
225-
os.copy(from, to, followLinks, replaceExisting, copyAttributes, createFolders)
266+
os.copy(
267+
from = from,
268+
to = to,
269+
followLinks = followLinks,
270+
replaceExisting = replaceExisting,
271+
copyAttributes = copyAttributes,
272+
createFolders = createFolders,
273+
mergeFolders = false
274+
)
226275
}
227276
}
228277
}

0 commit comments

Comments
 (0)