diff options
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. * |
