Commit Graph

26 Commits

Author SHA1 Message Date
809b9e4f4a utils: read_from_stdin: avoid reading nuls
We should read the actual written size, not the allocated size.
2026-08-20 15:05:30 -07:00
86464cd083 modernization: tweaks for c++20
Update various places for what we can do with C++20:

- ends_with / starts_with
- std::to_array
- using instead of typedef
- designated initializers
- "[[maybe_unused]]" instead of G_GNUC_UNUSED

Also remove some unnecessary 'static'
2026-08-20 15:05:30 -07:00
6715ff418a lib/utils: small cleanups
Fix some static analysis warnings
2026-08-20 15:05:29 -07:00
339cf0bd65 mu-utils-file: use std::filesystem::remove_all
Instead of the hacky "rm -rf"
2026-08-20 15:05:28 -07:00
3c4b50e7a2 mu-utils-file: remove some unused code 2026-08-20 15:05:28 -07:00
45b9722040 mu/lib: fix some possible quoting issues 2026-08-20 15:05:28 -07:00
d258c77661 utils/file: rework remove_directory, add test
Make remove_directory not much less ugly, but at least more robust, e.g., when
the "rm" binary is not at /bin/rm

Add unit test
2026-08-20 15:04:27 -07:00
8c706a77db mu-init: automatic export labels with --reinit
When re-initializing the store, automatically write the labels to a file in mu's
cache, so user can later import them.
2025-08-16 16:20:33 +03:00
dee7e5951c utils-file: add unit-test for expand_file 2024-12-09 19:41:58 +02:00
a0d60d23b0 compat: include sys/wait.h where needed
netbsd needs this explicitly, other systems let us get away without it.
2024-04-21 22:08:10 +03:00
fcd89039eb expand_path: better handle paths with spaces
I.e., work around surprising behavior of wordexp

Fixes #2566.
2023-10-07 00:18:56 +03:00
ee18c02762 maildir: improve unit tests
And get some more info from run_command.
2023-09-24 21:33:18 +03:00
abb0fb4fd5 utils/add: improve unit test coverage 2023-09-24 17:29:56 +03:00
24add72126 mu-file-utils: add run_command0
To ensure command ran and had exit-code=0 in one go.
2023-09-19 22:26:45 +03:00
0a12b70d7b utils-file: improve mu_play
implement in terms of run_command
2023-09-13 23:03:51 +03:00
c8568eecd4 utils/file: add basename/dirname helpers and use them 2023-09-10 10:15:28 +03:00
e1308a9b40 utils: small tweaks 2023-08-27 11:07:55 +03:00
111e48efa3 utils: add expand_path (wordexp wrapper)
For expanding command-line options for shells that don't do that by themselves.
2023-08-03 22:47:27 +03:00
cf6c5a36d7 utils: rework running system commands
Use g_spawn and pass arguments, so we don't involve a shell that needs
escaping etc.

Improve error handling.
2023-07-18 20:19:27 +03:00
cc65b8b401 utils: add some more helpers for test code
Creating and removing (temp) dirs, running mu commands.
2023-07-10 23:15:40 +03:00
4920b56671 update to use fmt-based apis
Not complete, but a first big stab converting users of Mu::Error and
various g_warning & friends, format to the new libfmt-based APIs.
2023-07-05 23:10:13 +03:00
3a05dd8725 lib/utils: implement read_from_stdin 2023-04-29 23:01:12 +03:00
e4af910d04 utils: implement g_cancellable_new_with_timeout 2023-04-29 23:01:12 +03:00
a8daec9598 lib: use join_paths
Convert some manual concatenation to the new join_paths helper.
2023-01-29 10:13:29 +02:00
25635c5cfe utils: add join_paths + tests 2023-01-29 10:13:29 +02:00
6979a66630 utils: get rid of mu-util.[ch]
It was getting old...
Remove the unused parts, refactor the few parts still in use.
2023-01-14 20:02:05 +02:00