--- hatari/src/includes/file.h 2019/04/01 07:10:02 1.1.1.3 +++ hatari/src/includes/file.h 2019/04/09 08:56:56 1.1.1.18 @@ -1,44 +1,48 @@ /* - Hatari + Hatari - file.h + + This file is distributed under the GNU General Public License, version 2 + or at your option any later version. Read the file gpl.txt for details. */ #ifndef HATARI_FILE_H #define HATARI_FILE_H -/* File types */ -enum { - FILEFILTER_DISCFILES, - FILEFILTER_ALLFILES, - FILEFILTER_TOSROM, - FILEFILTER_MAPFILE, - FILEFILTER_YMFILE, - FILEFILTER_MEMORYFILE, -}; - -#ifdef __BEOS__ -#include -extern int alphasort(const void *d1, const void *d2); -extern int scandir(const char *dirname,struct dirent ***namelist, int(*select) __P((struct dirent *)), int (*dcomp) __P((const void *, const void *))); -#endif /* __BEOS__ */ +#include "config.h" +#include /* Needed for off_t */ + +#ifndef HAVE_FSEEKO +#define fseeko fseek +#endif +#ifndef HAVE_FTELLO +#define ftello ftell +#endif extern void File_CleanFileName(char *pszFileName); extern void File_AddSlashToEndFileName(char *pszFileName); -extern BOOL File_DoesFileExtensionMatch(char *pszFileName, char *pszExtension); -extern BOOL File_IsRootFileName(char *pszFileName); -extern char *File_RemoveFileNameDrive(char *pszFileName); -extern BOOL File_DoesFileNameEndWithSlash(char *pszFileName); -extern void File_RemoveFileNameTrailingSlashes(char *pszFileName); -extern BOOL File_FileNameIsMSA(char *pszFileName); -extern BOOL File_FileNameIsST(char *pszFileName); -extern void *File_Read(char *pszFileName, void *pAddress, long *pFileSize, char *ppszExts[]); -extern BOOL File_Save(char *pszFileName, void *pAddress,long Size,BOOL bQueryOverwrite); -extern int File_Length(char *pszFileName); -extern BOOL File_Exists(char *pszFileName); -extern BOOL File_Delete(char *pszFileName); -extern BOOL File_QueryOverwrite(char *pszFileName); -extern BOOL File_FindPossibleExtFileName(char *pszFileName,char *ppszExts[]); -extern void File_splitpath(char *pSrcFileName, char *pDir, char *pName, char *Ext); -extern void File_makepath(char *pDestFileName, char *pDir, char *pName, char *pExt); -extern void File_ShrinkName(char *pDestFileName, char *pSrcFileName, int maxlen); +extern bool File_DoesFileExtensionMatch(const char *pszFileName, const char *pszExtension); +extern bool File_ChangeFileExtension(const char *Filename_old, const char *Extension_old , char *Filename_new , const char *Extension_new); +extern const char *File_RemoveFileNameDrive(const char *pszFileName); +extern bool File_DoesFileNameEndWithSlash(char *pszFileName); +extern Uint8 *File_Read(const char *pszFileName, long *pFileSize, const char * const ppszExts[]); +extern bool File_Save(const char *pszFileName, const Uint8 *pAddress, size_t Size, bool bQueryOverwrite); +extern off_t File_Length(const char *pszFileName); +extern bool File_Exists(const char *pszFileName); +extern bool File_DirExists(const char *psDirName); +extern bool File_QueryOverwrite(const char *pszFileName); +extern char* File_FindPossibleExtFileName(const char *pszFileName,const char * const ppszExts[]); +extern void File_SplitPath(const char *pSrcFileName, char *pDir, char *pName, char *Ext); +extern char* File_MakePath(const char *pDir, const char *pName, const char *pExt); +extern void File_ShrinkName(char *pDestFileName, const char *pSrcFileName, int maxlen); +extern FILE *File_Open(const char *path, const char *mode); +extern FILE *File_Close(FILE *fp); +extern bool File_Lock(FILE *fp); +extern void File_UnLock(FILE *fp); +extern bool File_InputAvailable(FILE *fp); +extern void File_MakeAbsoluteSpecialName(char *pszFileName); +extern void File_MakeAbsoluteName(char *pszFileName); +extern void File_MakeValidPathName(char *pPathName); +extern void File_PathShorten(char *path, int dirs); +extern void File_HandleDotDirs(char *path); #endif /* HATARI_FILE_H */