diff --git a/Makefile.common b/Makefile.common
index 973535e57c..cc26800513 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -96,6 +96,7 @@ OBJ += frontend/frontend.o \
dir_list.o \
libretro-sdk/string/string_list.o \
rarch_file_path.o \
+ rarch_compr_file_path.o \
hash.o \
driver.o \
general.o \
@@ -632,6 +633,7 @@ endif
JOYCONFIG_OBJ += tools/retroarch-joyconfig.o \
conf/config_file.o \
rarch_file_path.o \
+ rarch_compr_file_path.o \
libretro-sdk/string/string_list.o \
libretro-sdk/compat/compat.o \
tools/input_common_joyconfig.o
diff --git a/griffin/griffin.c b/griffin/griffin.c
index f1e21875d6..8bf6873b2d 100644
--- a/griffin/griffin.c
+++ b/griffin/griffin.c
@@ -523,6 +523,7 @@ FILE
#include "../dir_list.c"
#include "../libretro-sdk/string/string_list.c"
#include "../rarch_file_path.c"
+#include "../rarch_compr_file_path.c"
#include "../libretro-sdk/file/file_list.c"
/*============================================================
diff --git a/rarch_compr_file_path.c b/rarch_compr_file_path.c
new file mode 100644
index 0000000000..d08dc4aaaa
--- /dev/null
+++ b/rarch_compr_file_path.c
@@ -0,0 +1,165 @@
+/* RetroArch - A frontend for libretro.
+ * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
+ * Copyright (C) 2011-2014 - Daniel De Matteis
+ *
+ * RetroArch is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Found-
+ * ation, either version 3 of the License, or (at your option) any later version.
+ *
+ * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with RetroArch.
+ * If not, see .
+ */
+
+#include "file_path.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#ifdef __HAIKU__
+#include
+#endif
+
+#if (defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)) || defined(__QNX__) || defined(PSP)
+#include /* stat() is defined here */
+#endif
+
+#if defined(__CELLOS_LV2__)
+
+#ifndef S_ISDIR
+#define S_ISDIR(x) (x & 0040000)
+#endif
+
+#endif
+
+#if defined(_WIN32)
+#ifdef _MSC_VER
+#define setmode _setmode
+#endif
+#ifdef _XBOX
+#include
+#define INVALID_FILE_ATTRIBUTES -1
+#else
+#include
+#include
+#include
+#include
+#endif
+#else
+#include
+#include
+#include
+#include
+#endif
+
+#ifdef HAVE_7ZIP
+#include "decompress/7zip_support.h"
+#endif
+#ifdef HAVE_ZLIB
+#include "decompress/zip_support.h"
+#endif
+
+/* Generic compressed file loader.
+ * Extracts to buf, unless optional_filename != 0
+ * Then extracts to optional_filename and leaves buf alone.
+ */
+#ifdef HAVE_COMPRESSION
+long read_compressed_file(const char * path, void **buf,
+ const char* optional_filename)
+{
+ /* Safety check.
+ * If optional_filename and optional_filename exists, we simply return 0,
+ * hoping that optional_filename is the same as requested.
+ */
+ if (optional_filename)
+ if(path_file_exists(optional_filename))
+ return 0;
+
+ //We split carchive path and relative path:
+ char archive_path[PATH_MAX];
+ strlcpy(archive_path,path,sizeof(archive_path));
+ char* archive_found = strchr(archive_path,'#');
+ rarch_assert(archive_found != NULL);
+
+ //We assure that there is something after the '#' symbol
+ if (strlen(archive_found) <= 1)
+ {
+ /*
+ * This error condition happens for example, when
+ * path = /path/to/file.7z, or
+ * path = /path/to/file.7z#
+ */
+ RARCH_ERR("Could not extract image path and carchive path from "
+ "path: %s.\n", path);
+ return -1;
+ }
+
+ //We split the string in two, by putting a \0, where the hash was:
+ *archive_found = '\0';
+ archive_found+=1;
+
+
+ const char* file_ext = path_get_extension(archive_path);
+#ifdef HAVE_7ZIP
+ if (strcasecmp(file_ext,"7z") == 0)
+ return read_7zip_file(archive_path,archive_found,buf,optional_filename);
+#endif
+#ifdef HAVE_ZLIB
+ if (strcasecmp(file_ext,"zip") == 0)
+ return read_zip_file(archive_path,archive_found,buf,optional_filename);
+#endif
+ return -1;
+}
+#endif
+
+struct string_list *compressed_file_list_new(const char *path,
+ const char* ext)
+{
+#ifdef HAVE_COMPRESSION
+ const char* file_ext = path_get_extension(path);
+#ifdef HAVE_7ZIP
+ if (strcasecmp(file_ext,"7z") == 0)
+ return compressed_7zip_file_list_new(path,ext);
+#endif
+#ifdef HAVE_ZLIB
+ if (strcasecmp(file_ext,"zip") == 0)
+ return compressed_zip_file_list_new(path,ext);
+#endif
+
+#endif
+ return NULL;
+}
+
+bool path_is_compressed_file(const char* path)
+{
+#ifdef HAVE_COMPRESSION
+ const char* file_ext = path_get_extension(path);
+#ifdef HAVE_7ZIP
+ if (strcmp(file_ext,"7z") == 0)
+ return true;
+#endif
+#ifdef HAVE_ZLIB
+ if (strcmp(file_ext,"zip") == 0)
+ return true;
+#endif
+
+#endif
+ return false;
+}
+
+bool path_contains_compressed_file(const char *path)
+{
+ /*
+ * Currently we only check for hash symbol inside the pathname.
+ * If path is ever expanded to a general URI, we should check for that here.
+ */
+ return (strchr(path,'#') != NULL);
+}
diff --git a/rarch_file_path.c b/rarch_file_path.c
index 40ccdabef0..e3c576fdbf 100644
--- a/rarch_file_path.c
+++ b/rarch_file_path.c
@@ -60,13 +60,6 @@
#include
#endif
-#ifdef HAVE_7ZIP
-#include "decompress/7zip_support.h"
-#endif
-#ifdef HAVE_ZLIB
-#include "decompress/zip_support.h"
-#endif
-
/* Dump to file. */
bool write_file(const char *path, const void *data, size_t size)
{
@@ -91,59 +84,6 @@ bool write_empty_file(const char *path)
return true;
}
-/* Generic compressed file loader.
- * Extracts to buf, unless optional_filename != 0
- * Then extracts to optional_filename and leaves buf alone.
- */
-#ifdef HAVE_COMPRESSION
-long read_compressed_file(const char * path, void **buf,
- const char* optional_filename)
-{
- /* Safety check.
- * If optional_filename and optional_filename exists, we simply return 0,
- * hoping that optional_filename is the same as requested.
- */
- if (optional_filename)
- if(path_file_exists(optional_filename))
- return 0;
-
- //We split carchive path and relative path:
- char archive_path[PATH_MAX];
- strlcpy(archive_path,path,sizeof(archive_path));
- char* archive_found = strchr(archive_path,'#');
- rarch_assert(archive_found != NULL);
-
- //We assure that there is something after the '#' symbol
- if (strlen(archive_found) <= 1)
- {
- /*
- * This error condition happens for example, when
- * path = /path/to/file.7z, or
- * path = /path/to/file.7z#
- */
- RARCH_ERR("Could not extract image path and carchive path from "
- "path: %s.\n", path);
- return -1;
- }
-
- //We split the string in two, by putting a \0, where the hash was:
- *archive_found = '\0';
- archive_found+=1;
-
-
- const char* file_ext = path_get_extension(archive_path);
-#ifdef HAVE_7ZIP
- if (strcasecmp(file_ext,"7z") == 0)
- return read_7zip_file(archive_path,archive_found,buf,optional_filename);
-#endif
-#ifdef HAVE_ZLIB
- if (strcasecmp(file_ext,"zip") == 0)
- return read_zip_file(archive_path,archive_found,buf,optional_filename);
-#endif
- return -1;
-}
-#endif
-
static long read_generic_file(const char *path, void **buf)
{
long rc = 0, len = 0;
@@ -269,24 +209,6 @@ char *path_remove_extension(char *path)
return last;
}
-struct string_list *compressed_file_list_new(const char *path,
- const char* ext)
-{
-#ifdef HAVE_COMPRESSION
- const char* file_ext = path_get_extension(path);
-#ifdef HAVE_7ZIP
- if (strcasecmp(file_ext,"7z") == 0)
- return compressed_7zip_file_list_new(path,ext);
-#endif
-#ifdef HAVE_ZLIB
- if (strcasecmp(file_ext,"zip") == 0)
- return compressed_zip_file_list_new(path,ext);
-#endif
-
-#endif
- return NULL;
-}
-
static bool path_char_is_slash(char c)
{
#ifdef _WIN32
@@ -305,32 +227,6 @@ static const char *path_default_slash(void)
#endif
}
-bool path_contains_compressed_file(const char *path)
-{
- /*
- * Currently we only check for hash symbol inside the pathname.
- * If path is ever expanded to a general URI, we should check for that here.
- */
- return (strchr(path,'#') != NULL);
-}
-
-bool path_is_compressed_file(const char* path)
-{
-#ifdef HAVE_COMPRESSION
- const char* file_ext = path_get_extension(path);
-#ifdef HAVE_7ZIP
- if (strcmp(file_ext,"7z") == 0)
- return true;
-#endif
-#ifdef HAVE_ZLIB
- if (strcmp(file_ext,"zip") == 0)
- return true;
-#endif
-
-#endif
- return false;
-}
-
bool path_is_directory(const char *path)
{
#ifdef _WIN32
@@ -428,6 +324,7 @@ void fill_pathname_base(char *out, const char *in_path, size_t size)
else
ptr = in_path;
+#ifdef HAVE_COMPRESSION
/* In case of compression, we also have to consider paths like
* /path/to/archive.7z#mygame.img
* and
@@ -435,7 +332,6 @@ void fill_pathname_base(char *out, const char *in_path, size_t size)
* basename would be mygame.img in both cases
*/
-#ifdef HAVE_COMPRESSION
const char *ptr_bak = ptr;
ptr = strchr(ptr_bak,'#');
if (ptr)