Merge remote-tracking branch 'refs/remotes/origin/master'

This commit is contained in:
nretro
2019-05-25 20:04:43 +02:00
23 changed files with 1104 additions and 124 deletions

View File

@@ -508,9 +508,11 @@ int FileWriteSec(fileTYPE *file, void *pBuffer)
return FileWriteAdv(file, pBuffer, 512);
}
int FileSave(const char *name, void *pBuffer, int size)
int FileSave(const char *name, void *pBuffer, int size, int sys)
{
sprintf(full_path, "%s/%s", getRootDir(), name);
if(!sys) sprintf(full_path, "%s/%s", getRootDir(), name);
else strcpy(full_path, name);
int fd = open(full_path, O_WRONLY | O_CREAT | O_TRUNC | O_SYNC, S_IRWXU | S_IRWXG | S_IRWXO);
if (fd < 0)
{
@@ -537,9 +539,11 @@ int FileSaveConfig(const char *name, void *pBuffer, int size)
return FileSave(path, pBuffer, size);
}
int FileLoad(const char *name, void *pBuffer, int size)
int FileLoad(const char *name, void *pBuffer, int size, int sys)
{
sprintf(full_path, "%s/%s", getRootDir(), name);
if (!sys) sprintf(full_path, "%s/%s", getRootDir(), name);
else strcpy(full_path, name);
int fd = open(full_path, O_RDONLY);
if (fd < 0)
{
@@ -581,6 +585,12 @@ int FileLoadConfig(const char *name, void *pBuffer, int size)
return FileLoad(path, pBuffer, size);
}
int FileExists(const char *name)
{
sprintf(full_path, "%s/%s", getRootDir(), name);
return !access(full_path, F_OK);
}
int FileCanWrite(const char *name)
{
sprintf(full_path, "%s/%s", getRootDir(), name);