file_functions.h

Go to the documentation of this file.
00001 
00008 /*
00009  * Copyright © 2008  Red Hat, Inc. All rights reserved.
00010  * Copyright © 2008  Ding-Yi Chen <dchen at redhat dot com>
00011  *
00012  * This file is part of the libUnihan Project.
00013  *
00014  * This library is free software; you can redistribute it and/or
00015  * modify it under the terms of the GNU Lesser General Public
00016  * License as published by the Free Software Foundation; either
00017  * version 2 of the License, or (at your option) any later version.
00018  *
00019  * This library is distributed in the hope that it will be useful,
00020  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022  * GNU Lesser General Public License for more details.
00023  *
00024  * You should have received a copy of the GNU Lesser General Public
00025  * License along with this program; if not, write to the
00026  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
00027  * Boston, MA  02111-1307  USA
00028  */
00029 
00030  
00031 #ifndef FILE_FUNCTIONS_H_
00032 #define FILE_FUNCTIONS_H_
00033 #include <string.h>
00034 #include <stdbool.h>
00035 #include <limits.h>
00036 #include <glib.h>
00037 #include "str_functions.h"
00038 
00045 #ifdef WIN32
00046 #define DIRECTORY_SEPARATOR '\\'
00047 #else
00048 #define DIRECTORY_SEPARATOR '/'
00049 #endif
00050 
00057 typedef enum{
00058     TASK_RUNNING, 
00059     TASK_CANCELED, 
00060     TASK_FAILED,   
00061     TASK_COMPLETED 
00062 } TaskStatus;
00063 
00064 
00071 #ifdef WIN32
00072 #define PATH_SEPARATOR ';'
00073 #else
00074 #define PATH_SEPARATOR ':'
00075 #endif
00076 
00077 
00088 gchar*
00089 truepath(const gchar *path, gchar *resolved_path);
00090 
00097 gboolean
00098 isReadable(const gchar *filename);
00099 
00100 
00109 gboolean
00110 isWritable(const gchar *filename);
00111 
00123 #define FILE_MODE_EXIST    1<<4  
00124 #define FILE_MODE_DIRECTORY   1<<3  
00125 #define FILE_MODE_READ     1<<2  
00126 #define FILE_MODE_WRITE    1<<1  
00127 #define FILE_MODE_EXECUTE  1  
00128 
00147 gboolean filename_meets_accessMode(const gchar *filename, guint access_mode_mask);
00148 
00159 gchar*
00160 filename_search_paths(const gchar *filename,const gchar* search_paths);
00161 
00181 gchar*
00182 filename_search_paths_mode(const gchar *filename,const gchar* search_paths,guint access_mode_mask);
00183 
00219 typedef TaskStatus (* ChooseFilenameFunc) (gchar *filename_buf, guint filename_len, StringList *extensions, guint access_mode_mask, const gchar * prompt, gpointer option);
00220 
00248 gchar *filename_choose
00249 (const gchar *filename_default, guint filename_len, StringList *extensions,
00250  guint access_mode_mask, const gchar * prompt, gpointer option, ChooseFilenameFunc callback);
00251 
00252 
00253 
00254 #endif /*FILE_FUNCTIONS_H_*/
00255 

Generated on Tue Oct 21 03:47:17 2008 for libUnihan by  doxygen 1.4.7