diff options
| author | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2026-07-26 14:23:21 +0200 |
|---|---|---|
| committer | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2026-07-26 14:23:21 +0200 |
| commit | bbbe4cdbc9ba9d43582c9420303d2aab977673a4 (patch) | |
| tree | 8d64d823905e07c539c3dcfb76ae77695e518298 /src/file-utils.h | |
| parent | cca906658aee1dcaa38787880c54fe304f9f2e94 (diff) | |
hide #recovery# files from auto-completions, unless you already typed '#'HEADmaster-fmsbw-cimaster
* These files are created regularily and shouldn't be mangled with unless you're
recovering from a crash.
So it makes sense to hide them by default, just like the hidden .teco-* savepoint
files.
* Recovery file name creation and checks are now centralized in file-utils.h.
Diffstat (limited to 'src/file-utils.h')
| -rw-r--r-- | src/file-utils.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/file-utils.h b/src/file-utils.h index 11d6650..2b9003d 100644 --- a/src/file-utils.h +++ b/src/file-utils.h @@ -66,6 +66,22 @@ teco_file_normalize_path(gchar *path) gboolean teco_file_is_visible(const gchar *path); +static inline gboolean +teco_file_is_recovery(const gchar *path) +{ + g_autofree gchar *basename = g_path_get_basename(path); + gsize len = strlen(basename); + return len > 2 && basename[0] == '#' && basename[len-1] == '#'; +} + +static inline gchar * +teco_file_get_recovery(const gchar *path) +{ + g_autofree gchar *dirname = g_path_get_dirname(path); + g_autofree gchar *basename = g_path_get_basename(path); + return g_strconcat(dirname, G_DIR_SEPARATOR_S, "#", basename, "#", NULL); +} + /** * Get absolute path of the program executable. * |
