Commit Graph

13 Commits

Author SHA1 Message Date
PerikiyoXD
bdc028da1c cp: Print proper error message with strerror
When cp fails, now it prints an error string (strerror)
instead of an error code.
2021-12-20 10:40:02 -08:00
Brian Gianforcaro
cf4fa936be Everywhere: Use default execpromises argument for Core::System::pledge 2021-11-28 08:04:57 +01:00
Andreas Kling
0b8fb8358e cp: Port to LibMain :^) 2021-11-26 23:27:57 +01:00
Andreas Kling
f1cc3d0fc4 Userland: Use Core::ArgsParser's Vector<StringView> API everywhere
...and remove the Vector<String> variant since there are no remaining
users of this API.
2021-11-26 23:27:57 +01:00
Andreas Kling
4a2b718ba2 LibCore: Use ErrorOr<T> for Core::File::copy_file() 2021-11-08 00:35:27 +01:00
Jean-Baptiste Boric
58cebf1b6f Utilities: Implement -p flag for cp 2021-08-18 20:30:46 +02:00
Max Wipfli
fc6d051dfd AK+Everywhere: Add and use static APIs for LexicalPath
The LexicalPath instance methods dirname(), basename(), title() and
extension() will be changed to return StringView const& in a further
commit. Due to this, users creating temporary LexicalPath objects just
to call one of those getters will recieve a StringView const& pointing
to a possible freed buffer.

To avoid this, static methods for those APIs have been added, which will
return a String by value to avoid those problems. All cases where
temporary LexicalPath objects have been used as described above haven
been changed to use the static APIs.
2021-06-30 11:13:54 +02:00
Sam Atkins
e79ef6461a cp: Copy sources into destination if it is already a directory
Previously, copying a file to a directory, like this:
```cp README.md Desktop```
correctly copied it to Desktop/README.md, but would fail if the
source was also a directory, for example:
```cp -R Documents Desktop```
Now, that correctly copies it to Desktop/Documents, as you would
expect. :^)
2021-06-21 16:50:29 +02:00
Linus Groh
f5c35fccca Userland: Replace most printf-style APIs with AK::Format APIs :^) 2021-06-01 21:30:16 +01:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Mițca Dumitru
3f88fd81d1 cp: Use Core::File::copy_file_or_directory 2021-02-21 18:14:29 +01:00
Bui Quang Minh
ff67340d81 Userland: Support moving files between different mounted filesystems
In case we cannot use rename() because of cross-device error, copy file to the
destination then unlink the old source file.
2021-02-20 09:30:11 +01:00
Andreas Kling
ececac65c2 Userland: Move command-line utilities to Userland/Utilities/ 2021-01-12 12:04:09 +01:00