Commit 6d23f9f7 authored by npzacs's avatar npzacs
Browse files

Merge file_unlink() from libbluray

parent 90733270
...@@ -50,6 +50,7 @@ BD_PRIVATE extern AACS_FILE_H *(*file_open)(const char* filename, const char *mo ...@@ -50,6 +50,7 @@ BD_PRIVATE extern AACS_FILE_H *(*file_open)(const char* filename, const char *mo
* local filesystem * local filesystem
*/ */
BD_PRIVATE int file_unlink(const char *file);
BD_PRIVATE int file_mkdir(const char *dir); BD_PRIVATE int file_mkdir(const char *dir);
#endif /* FILE_H_ */ #endif /* FILE_H_ */
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <errno.h> #include <errno.h>
#include <inttypes.h> #include <inttypes.h>
#include <stdio.h> // remove()
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
...@@ -133,6 +134,11 @@ static AACS_FILE_H *_file_open(const char* filename, const char *cmode) ...@@ -133,6 +134,11 @@ static AACS_FILE_H *_file_open(const char* filename, const char *cmode)
AACS_FILE_H* (*file_open)(const char* filename, const char *mode) = _file_open; AACS_FILE_H* (*file_open)(const char* filename, const char *mode) = _file_open;
int file_unlink(const char *file)
{
return remove(file);
}
int file_mkdir(const char *dir) int file_mkdir(const char *dir)
{ {
return mkdir(dir, S_IRWXU); return mkdir(dir, S_IRWXU);
......
...@@ -113,6 +113,14 @@ static AACS_FILE_H *_file_open(const char* filename, const char *mode) ...@@ -113,6 +113,14 @@ static AACS_FILE_H *_file_open(const char* filename, const char *mode)
AACS_FILE_H* (*file_open)(const char* filename, const char *mode) = _file_open; AACS_FILE_H* (*file_open)(const char* filename, const char *mode) = _file_open;
int file_unlink(const char *file)
{
wchar_t wfile[MAX_PATH];
MultiByteToWideChar(CP_UTF8, 0, file, -1, wfile, MAX_PATH);
return _wremove(wfile);
}
int file_mkdir(const char *dir) int file_mkdir(const char *dir)
{ {
wchar_t wdir[MAX_PATH]; wchar_t wdir[MAX_PATH];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment