sidecar files grouping was made case-insensitive
[geeqie.git] / src / ui_fileops.h
1 /*
2  * (SLIK) SimpLIstic sKin functions
3  * (C) 2004 John Ellis
4  * Copyright (C) 2008 The Geeqie Team
5  *
6  * Author: John Ellis
7  *
8  * This software is released under the GNU General Public License (GNU GPL).
9  * Please read the included file COPYING for more information.
10  * This software comes with no warranty of any kind, use at your own risk!
11  */
12
13
14 #ifndef UI_FILEOPS_H
15 #define UI_FILEOPS_H
16
17
18 #include <sys/stat.h>
19 #include <sys/time.h>
20 #include <sys/types.h>
21 #include <time.h>
22
23
24
25 void print_term(const gchar *text_utf8);
26
27 #define printf_term(...) \
28         do { \
29                 gchar *msg = g_strdup_printf(__VA_ARGS__); \
30                 print_term(msg); \
31                 g_free(msg); \
32         } while (0)
33
34 gchar *path_to_utf8(const gchar *path);
35 gchar *path_from_utf8(const gchar *path);
36
37 const gchar *xdg_data_home_get(void);
38 const gchar *xdg_config_home_get(void);
39 const gchar *xdg_cache_home_get(void);
40 const gchar *homedir(void);
41 const gchar *get_rc_dir(void);
42 const gchar *get_collections_dir(void);
43 const gchar *get_trash_dir(void);
44
45 gint stat_utf8(const gchar *s, struct stat *st);
46 gint lstat_utf8(const gchar *s, struct stat *st);
47 gint stat_utf8_case_insensitive_ext(GString *base, const gchar *ext, struct stat *st);
48
49
50 gint isname(const gchar *s);
51 gint isfile(const gchar *s);
52 gint isdir(const gchar *s);
53 gint islink(const gchar *s);
54 gint64 filesize(const gchar *s);
55 time_t filetime(const gchar *s);
56 gint filetime_set(const gchar *s, time_t tval);
57 gint access_file(const gchar *s, gint mode);
58 gint unlink_file(const gchar *s);
59 gint symlink_utf8(const gchar *source, const gchar *target);
60 gint mkdir_utf8(const gchar *s, gint mode);
61 gint rmdir_utf8(const gchar *s);
62 gint copy_file_attributes(const gchar *s, const gchar *t, gint perms, gint mtime);
63 gint copy_file(const gchar *s, const gchar *t);
64 gint move_file(const gchar *s, const gchar *t);
65 gint rename_file(const gchar *s, const gchar *t);
66 gchar *get_current_dir(void);
67
68 /* return True on success, it is up to you to free
69  * the lists with string_list_free()
70  */
71 void string_list_free(GList *list);
72 GList *string_list_copy(GList *list);
73
74 gchar *unique_filename(const gchar *path, const gchar *ext, const gchar *divider, gint pad);
75 gchar *unique_filename_simple(const gchar *path);
76
77 const gchar *filename_from_path(const gchar *path);
78 gchar *remove_level_from_path(const gchar *path);
79
80 const gchar *extension_from_path(const gchar *path);
81 gchar *remove_extension_from_path(const gchar *path);
82
83 gint file_extension_match(const gchar *path, const gchar *ext);
84
85 /* warning note: this modifies path string! */
86 void parse_out_relatives(gchar *path);
87
88 gint file_in_path(const gchar *name);
89
90 gboolean recursive_mkdir_if_not_exists(const gchar *path, mode_t mode);
91
92 #endif
93 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */