mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:27:35 +00:00
Everywhere: Convert a handful of String::format() => formatted()
This commit is contained in:
parent
c90b7881a7
commit
c71807a3fc
23 changed files with 24 additions and 24 deletions
|
@ -55,7 +55,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
|
||||
auto hash_name = program_name.substring_view(0, program_name.length() - 3).to_string().to_uppercase();
|
||||
auto paths_help_string = String::format("File(s) to print %s checksum of", hash_name.characters());
|
||||
auto paths_help_string = String::formatted("File(s) to print {} checksum of", hash_name);
|
||||
|
||||
Vector<const char*> paths;
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ int main(int argc, char** argv)
|
|||
|
||||
umask(0644);
|
||||
|
||||
auto filename = String::format("%s/disk_benchmark.tmp", directory);
|
||||
auto filename = String::formatted("{}/disk_benchmark.tmp", directory);
|
||||
|
||||
for (auto file_size : file_sizes) {
|
||||
for (auto block_size : block_sizes) {
|
||||
|
|
|
@ -57,7 +57,7 @@ int main(int argc, char** argv)
|
|||
|
||||
for (String filename : filenames) {
|
||||
if (!filename.ends_with(".gz"))
|
||||
filename = String::format("%s.gz", filename.characters());
|
||||
filename = String::formatted("{}.gz", filename);
|
||||
|
||||
const auto input_filename = filename;
|
||||
const auto output_filename = filename.substring_view(0, filename.length() - 3);
|
||||
|
|
|
@ -84,7 +84,7 @@ static bool parse_name(StringView name, OpenFile& file)
|
|||
|
||||
static Vector<OpenFile> get_open_files_by_pid(pid_t pid)
|
||||
{
|
||||
auto file = Core::File::open(String::format("/proc/%d/fds", pid), Core::IODevice::OpenMode::ReadOnly);
|
||||
auto file = Core::File::open(String::formatted("/proc/{}/fds", pid), Core::IODevice::OpenMode::ReadOnly);
|
||||
if (file.is_error()) {
|
||||
printf("lsof: PID %d: %s\n", pid, file.error().characters());
|
||||
return Vector<OpenFile>();
|
||||
|
|
|
@ -68,7 +68,7 @@ int main(int argc, char* argv[])
|
|||
args_parser.parse(argc, argv);
|
||||
|
||||
auto make_path = [name](const char* section) {
|
||||
return String::format("/usr/share/man/man%s/%s.md", section, name);
|
||||
return String::formatted("/usr/share/man/man{}/{}.md", section, name);
|
||||
};
|
||||
if (!section) {
|
||||
const char* sections[] = {
|
||||
|
|
|
@ -75,7 +75,7 @@ static int get_source_fd(const char* source)
|
|||
fd = open(source, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
int saved_errno = errno;
|
||||
auto message = String::format("Failed to open: %s\n", source);
|
||||
auto message = String::formatted("Failed to open: {}\n", source);
|
||||
errno = saved_errno;
|
||||
perror(message.characters());
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ int main(int argc, char** argv)
|
|||
const char* new_path = original_new_path;
|
||||
if (rc == 0 && S_ISDIR(st.st_mode)) {
|
||||
auto old_basename = LexicalPath(old_path).basename();
|
||||
combined_new_path = String::format("%s/%s", original_new_path, old_basename.characters());
|
||||
combined_new_path = String::formatted("{}/{}", original_new_path, old_basename);
|
||||
new_path = combined_new_path.characters();
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ int main(int argc, char** argv)
|
|||
args_parser.add_positional_argument(pid, "PID", "PID", Core::ArgsParser::Required::Yes);
|
||||
args_parser.parse(argc, argv);
|
||||
|
||||
auto file = Core::File::construct(String::format("/proc/%s/vm", pid));
|
||||
auto file = Core::File::construct(String::formatted("/proc/{}/vm", pid));
|
||||
if (!file->open(Core::IODevice::ReadOnly)) {
|
||||
fprintf(stderr, "Error: %s\n", file->error_string());
|
||||
return 1;
|
||||
|
|
|
@ -265,7 +265,7 @@ int main(int argc, char** argv)
|
|||
do {
|
||||
output_name = url.host();
|
||||
if (i > -1)
|
||||
output_name = String::format("%s.%d", output_name.characters(), i);
|
||||
output_name = String::formatted("{}.{}", output_name, i);
|
||||
++i;
|
||||
} while (Core::File::exists(output_name));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue