00001
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
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
00084 gboolean
00085 isReadable(const gchar *filename);
00086
00087
00096 gboolean
00097 isWritable(const gchar *filename);
00098
00110 #define FILE_MODE_NO_SYMLINK 1<<5
00111 #define FILE_MODE_EXIST 1<<4
00112 #define FILE_MODE_DIRECTORY 1<<3
00113 #define FILE_MODE_READ 1<<2
00114 #define FILE_MODE_WRITE 1<<1
00115 #define FILE_MODE_EXECUTE 1
00116
00135 gboolean filename_meets_accessMode(const gchar *filename, guint access_mode_mask);
00136
00147 gchar*
00148 filename_search_paths(const gchar *filename,const gchar* search_paths);
00149
00169 gchar*
00170 filename_search_paths_mode(const gchar *filename,const gchar* search_paths,guint access_mode_mask);
00171
00207 typedef TaskStatus (* ChooseFilenameFunc) (gchar *filename_buf, guint filename_len, StringList *extensions, guint access_mode_mask, const gchar * prompt, gpointer option);
00208
00236 gchar *filename_choose
00237 (const gchar *filename_default, guint filename_len, StringList *extensions,
00238 guint access_mode_mask, const gchar * prompt, gpointer option, ChooseFilenameFunc callback);
00239
00261 StringList *lsDir(const gchar* dir, const gchar *globStr, guint access_mode_mask, gboolean keepPath);
00262
00281 StringList *lsDir_append(StringList *sList,const gchar* dir, const gchar *globStr, guint access_mode_mask, gboolean keepPath);
00282
00293 StringList *path_split(const gchar *path);
00294
00307 gchar *path_concat(gchar *dest, const gchar *src, gsize destSize);
00308
00319 gchar*
00320 truepath(const gchar *path, gchar *resolved_path);
00321
00322
00323 #endif
00324
00325