Commit fcb1fd98 authored by Petri Hintukainen's avatar Petri Hintukainen

caching: check for windows path separator

Simplify and add error checking
parent b683a904
......@@ -453,9 +453,20 @@ int disc_cache_bdrom_file(BD_DISC *p, const char *rel_path, const char *cache_pa
BD_FILE_H *fp_in;
BD_FILE_H *fp_out;
int64_t got;
size_t size;
if (rel_path[strlen(rel_path) - 1] == '/') {
file_mkdirs(cache_path);
if (!cache_path || !cache_path[0]) {
return -1;
}
/* make sure cache directory exists */
if (file_mkdirs(cache_path) < 0) {
return -1;
}
/* plain directory ? */
size = strlen(rel_path);
if (rel_path[size - 1] == '/' || rel_path[size - 1] == '\\') {
return 0;
}
......@@ -466,9 +477,6 @@ int disc_cache_bdrom_file(BD_DISC *p, const char *rel_path, const char *cache_pa
return -1;
}
/* make sure path exists */
file_mkdirs(cache_path);
/* output file in local filesystem */
fp_out = file_open(cache_path, "wb");
if (!fp_out) {
......
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