int app_remove(const char *path) { char realpath[MAX_PATH]; const char *fpath = handle_special_dirs(path, NEED_WRITE, realpath, sizeof (realpath)); if (!fpath) FILE_ERROR_RETURN(ENAMETOOLONG, -1); return os_remove(fpath); }
int app_open(const char *path, int oflag, ...) { int flags = IS_FILE; if (oflag & O_ACCMODE) flags |= NEED_WRITE; char realpath[MAX_PATH]; const char *fpath = handle_special_dirs(path, flags, realpath, sizeof (realpath)); if (!fpath) FILE_ERROR_RETURN(ENAMETOOLONG, -1); return os_open(fpath, oflag __OPEN_MODE_ARG); }
void *lc_open(const char *filename, unsigned char *buf, size_t buf_size) { (void)buf; (void)buf_size; char path[MAX_PATH]; const char *fpath = handle_special_dirs(filename, 0, path, sizeof(path)); void *handle = dlopen(fpath, RTLD_NOW); if (handle == NULL) { DEBUGF("failed to load %s\n", filename); DEBUGF("lc_open(%s): %s\n", filename, dlerror()); } return handle; }
int app_remove(const char *path) { char realpath[MAX_PATH]; const char *fpath = handle_special_dirs(path, NEED_WRITE, realpath, sizeof (realpath)); if (!fpath) FILE_ERROR_RETURN(ENAMETOOLONG, -1); return os_remove(fpath); } int app_rename(const char *old, const char *new) { char realpath_old[MAX_PATH], realpath_new[MAX_PATH]; const char *fold = handle_special_dirs(old, NEED_WRITE, realpath_old, sizeof (realpath_old)); const char *fnew = handle_special_dirs(new, NEED_WRITE, realpath_new, sizeof (realpath_new)); if (!fold || !fnew) FILE_ERROR_RETURN(ENAMETOOLONG, -1); return os_rename(fold, fnew); } #ifdef HAVE_SDL_THREADS ssize_t app_read(int fd, void *buf, size_t nbyte) { return os_read(fd, buf, nbyte); } ssize_t app_write(int fd, const void *buf, size_t nbyte)