| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
#ifndef FONTFORGE_GFILE_H |
| 29 |
#define FONTFORGE_GFILE_H |
| 30 |
|
| 31 |
#include "basics.h" |
| 32 |
|
| 33 |
#include <stdio.h> |
| 34 |
#include <time.h> |
| 35 |
|
| 36 |
|
| 37 |
#include <sys/types.h> |
| 38 |
#include <sys/stat.h> |
| 39 |
|
| 40 |
|
| 41 |
#ifdef _MSC_VER |
| 42 |
typedef unsigned short mode_t; |
| 43 |
#endif |
| 44 |
|
| 45 |
#ifdef _MSC_VER |
| 46 |
typedef struct __stat64 ff_stat_t; |
| 47 |
#define ff_stat(p, b) _stat64(p, b) |
| 48 |
#define ff_fstat(f, b) _fstat64(f, b) |
| 49 |
#else |
| 50 |
typedef struct stat ff_stat_t; |
| 51 |
#define ff_stat(p, b) stat(p, b) |
| 52 |
#define ff_fstat(f, b) fstat(f, b) |
| 53 |
#endif |
| 54 |
|
| 55 |
|
| 56 |
enum { Cache, Config, Data }; |
| 57 |
|
| 58 |
#ifdef __cplusplus |
| 59 |
extern "C" { |
| 60 |
#endif |
| 61 |
|
| 62 |
int mkdir_p(const char *path, mode_t mode); |
| 63 |
|
| 64 |
extern char *GFileNormalizePath(char *path); |
| 65 |
extern unichar_t *u_GFileNormalizePath(unichar_t *path); |
| 66 |
|
| 67 |
extern char* GFileGetHomeDir(void); |
| 68 |
extern unichar_t* u_GFileGetHomeDir(void); |
| 69 |
|
| 70 |
extern char *GFileRemoveExtension(char *path); |
| 71 |
extern char *GFileGetAbsoluteName(const char *name); |
| 72 |
extern char *GFileBuildName(char *dir,char *fname,char *buffer,size_t size); |
| 73 |
extern char *GFileReplaceName(char *oldname,char *fname,char *buffer,size_t size); |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
extern char *GFileNameTail(const char *oldname); |
| 87 |
extern char *GFileAppendFile(char *dir,char *name,int isdir); |
| 88 |
extern int GFileIsAbsolute(const char *file); |
| 89 |
extern int GFileIsDir(const char *file); |
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
extern int GFileExists(const char *file); |
| 94 |
extern int GFileModifyable(const char *file); |
| 95 |
extern int GFileModifyableDir(const char *file); |
| 96 |
extern int GFileReadable(const char *file); |
| 97 |
extern FILE* GFileTmpfile(); |
| 98 |
extern int GFileRemove(const char *path, int recursive); |
| 99 |
extern int GFileMkDir(const char *name, int mode); |
| 100 |
extern int GFileRmDir(const char *name); |
| 101 |
extern int GFileUnlink(const char *name); |
| 102 |
extern char* GFileMimeType(const char *path); |
| 103 |
extern unichar_t *u_GFileBuildName(unichar_t *dir,unichar_t *fname,unichar_t *buffer,int size); |
| 104 |
extern unichar_t *u_GFileReplaceName(unichar_t *oldname,unichar_t *fname,unichar_t *buffer,int size); |
| 105 |
extern unichar_t *u_GFileNameTail(const unichar_t *oldname); |
| 106 |
extern unichar_t *u_GFileNormalize(unichar_t *name); |
| 107 |
extern unichar_t *u_GFileAppendFile(unichar_t *dir,unichar_t *name,int isdir); |
| 108 |
extern int u_GFileIsAbsolute(const unichar_t *file); |
| 109 |
extern int u_GFileIsDir(const unichar_t *file); |
| 110 |
extern int u_GFileExists(const unichar_t *file); |
| 111 |
extern int u_GFileModifyable(const unichar_t *file); |
| 112 |
extern int u_GFileModifyableDir(const unichar_t *file); |
| 113 |
extern int u_GFileReadable(unichar_t *file); |
| 114 |
extern int u_GFileMkDir(unichar_t *name); |
| 115 |
extern int u_GFileRmDir(unichar_t *name); |
| 116 |
extern int u_GFileUnlink(unichar_t *name); |
| 117 |
extern off_t GFileGetSize(char *name); |
| 118 |
extern off_t GFileGetSizeF(FILE *file); |
| 119 |
extern time_t GFileGetMTime(const char *name); |
| 120 |
extern time_t GFileGetMTimeF(FILE *file); |
| 121 |
extern char *GFileReadAll(char *name); |
| 122 |
extern int GFileWriteAll(char *filepath, char *data); |
| 123 |
extern void FindProgRoot(const char *prog); |
| 124 |
extern const char *getShareDir(); |
| 125 |
extern const char *getLocaleDir(void); |
| 126 |
extern const char *getPixmapDir(void); |
| 127 |
extern const char *getHelpDir(void); |
| 128 |
extern const char *getUserHomeDir(void); |
| 129 |
extern char *getFontForgeUserDir(int dir); |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
extern char *GFileGetHomeDocumentsDir(void); |
| 136 |
extern unichar_t* u_GFileGetHomeDocumentsDir(void); |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
extern char *GFileDirName(const char *path); |
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
extern char *GFileDirNameEx(const char *path, int treat_as_file); |
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
extern char* getLibexecDir_NonWindows(void); |
| 165 |
|
| 166 |
#ifdef __cplusplus |
| 167 |
} |
| 168 |
#endif |
| 169 |
|
| 170 |
#endif |