libUnihan  0.5.3
file_functions.h
Go to the documentation of this file.
1 
8 /*
9  * Copyright © 2008 Red Hat, Inc. All rights reserved.
10  * Copyright © 2008 Ding-Yi Chen <dchen at redhat dot com>
11  *
12  * This file is part of the libUnihan Project.
13  *
14  * This library is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU Lesser General Public
16  * License as published by the Free Software Foundation; either
17  * version 2 of the License, or (at your option) any later version.
18  *
19  * This library is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public
25  * License along with this program; if not, write to the
26  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
27  * Boston, MA 02111-1307 USA
28  */
29 
30 
31 #ifndef FILE_FUNCTIONS_H_
32 #define FILE_FUNCTIONS_H_
33 #include <string.h>
34 #include <stdbool.h>
35 #include <limits.h>
36 #include <glib.h>
37 #include "str_functions.h"
38 
45 #ifdef WIN32
46 #define DIRECTORY_SEPARATOR '\\'
47 #else
48 #define DIRECTORY_SEPARATOR '/'
49 #endif
50 
57 typedef enum{
58  TASK_RUNNING,
62 } TaskStatus;
63 
64 
71 #ifdef WIN32
72 #define PATH_SEPARATOR ';'
73 #else
74 #define PATH_SEPARATOR ':'
75 #endif
76 
77 
88 gchar*
89 truepath(const gchar *path, gchar *resolved_path);
90 
97 gboolean
98 isReadable(const gchar *filename);
99 
100 
109 gboolean
110 isWritable(const gchar *filename);
111 
123 #define FILE_MODE_EXIST 1<<4
124 #define FILE_MODE_DIRECTORY 1<<3
125 #define FILE_MODE_READ 1<<2
126 #define FILE_MODE_WRITE 1<<1
127 #define FILE_MODE_EXECUTE 1
128 
147 gboolean filename_meets_accessMode(const gchar *filename, guint access_mode_mask);
148 
159 gchar*
160 filename_search_paths(const gchar *filename,const gchar* search_paths);
161 
181 gchar*
182 filename_search_paths_mode(const gchar *filename,const gchar* search_paths,guint access_mode_mask);
183 
219 typedef TaskStatus (* ChooseFilenameFunc) (gchar *filename_buf, guint filename_len, StringList *extensions, guint access_mode_mask, const gchar * prompt, gpointer option);
220 
248 gchar *filename_choose
249 (const gchar *filename_default, guint filename_len, StringList *extensions,
250  guint access_mode_mask, const gchar * prompt, gpointer option, ChooseFilenameFunc callback);
251 
252 
253 
254 #endif /*FILE_FUNCTIONS_H_*/
255