2 * Copyright (C) 2004 John Ellis
3 * Copyright (C) 2008 - 2016 The Geeqie Team
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 #include <sys/types.h>
33 void print_term(const gchar *text_utf8);
35 #define printf_term(...) \
37 gchar *msg = g_strdup_printf(__VA_ARGS__); \
42 #if GQ_DEBUG_PATH_UTF8
43 #define path_to_utf8(path) path_to_utf8_debug(path, __FILE__, __LINE__)
44 #define path_from_utf8(utf8) path_from_utf8_debug(utf8, __FILE__, __LINE__)
45 gchar *path_to_utf8_debug(const gchar *path, const gchar *file, gint line);
46 gchar *path_from_utf8_debug(const gchar *utf8, const gchar *file, gint line);
48 gchar *path_to_utf8(const gchar *path);
49 gchar *path_from_utf8(const gchar *utf8);
52 const gchar *xdg_data_home_get(void);
53 const gchar *xdg_config_home_get(void);
54 const gchar *xdg_cache_home_get(void);
55 const gchar *homedir(void);
56 const gchar *get_rc_dir(void);
57 const gchar *get_collections_dir(void);
58 const gchar *get_trash_dir(void);
60 gboolean stat_utf8(const gchar *s, struct stat *st);
61 gboolean lstat_utf8(const gchar *s, struct stat *st);
63 gboolean isname(const gchar *s);
64 gboolean isfile(const gchar *s);
65 gboolean isdir(const gchar *s);
66 gboolean islink(const gchar *s);
67 gint64 filesize(const gchar *s);
68 time_t filetime(const gchar *s);
69 gboolean filetime_set(const gchar *s, time_t tval);
70 gboolean is_readable_file(const gchar *s);
71 gboolean access_file(const gchar *s, gint mode);
72 gboolean unlink_file(const gchar *s);
73 gboolean symlink_utf8(const gchar *source, const gchar *target);
74 gboolean mkdir_utf8(const gchar *s, gint mode);
75 gboolean rmdir_utf8(const gchar *s);
76 gboolean copy_file_attributes(const gchar *s, const gchar *t, gint perms, gint mtime);
77 gboolean copy_file(const gchar *s, const gchar *t);
78 gboolean move_file(const gchar *s, const gchar *t);
79 gboolean rename_file(const gchar *s, const gchar *t);
80 gchar *get_current_dir(void);
82 /* return True on success, it is up to you to free
83 * the lists with string_list_free()
85 void string_list_free(GList *list);
86 GList *string_list_copy(const GList *list);
88 gchar *unique_filename(const gchar *path, const gchar *ext, const gchar *divider, gboolean pad);
89 gchar *unique_filename_simple(const gchar *path);
91 const gchar *filename_from_path(const gchar *path);
92 gchar *remove_level_from_path(const gchar *path);
94 gchar *remove_extension_from_path(const gchar *path);
96 gboolean file_extension_match(const gchar *path, const gchar *ext);
98 /* warning note: this modifies path string! */
99 void parse_out_relatives(gchar *path);
101 gboolean file_in_path(const gchar *name);
103 gboolean recursive_mkdir_if_not_exists(const gchar *path, mode_t mode);
106 /* generate md5 string from file,
107 * on failure returns newly allocated copy of error_text, error_text may be NULL
109 gchar *md5_text_from_file_utf8(const gchar *path, const gchar *error_text);
110 gboolean md5_get_digest_from_file_utf8(const gchar *path, guchar digest[16]);
113 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */