aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
Diffstat (limited to 'Alc')
-rw-r--r--Alc/helpers.c149
1 files changed, 0 insertions, 149 deletions
diff --git a/Alc/helpers.c b/Alc/helpers.c
index 9a9273c4..c98f121f 100644
--- a/Alc/helpers.c
+++ b/Alc/helpers.c
@@ -476,84 +476,6 @@ void al_print(const char *type, const char *func, const char *fmt, ...)
static inline int is_slash(int c)
{ return (c == '\\' || c == '/'); }
-FILE *OpenDataFile(const char *fname, const char *subdir)
-{
- static const int ids[2] = { CSIDL_APPDATA, CSIDL_COMMON_APPDATA };
- WCHAR *wname=NULL, *wsubdir=NULL;
- FILE *f;
- size_t i;
-
- wname = FromUTF8(fname);
- if(!wname)
- {
- ERR("Failed to convert UTF-8 filename: \"%s\"\n", fname);
- return NULL;
- }
-
- /* If the path is absolute, open it directly. */
- if(wname[0] != '\0' && wname[1] == ':' && is_slash(wname[2]))
- {
- f = _wfopen(wname, L"rb");
- if(f) TRACE("Opened %s\n", fname);
- else WARN("Could not open %s\n", fname);
- free(wname);
- return f;
- }
-
- /* Try the current directory first before the data directories. */
- if((f=_wfopen(wname, L"rb")) != NULL)
- {
- TRACE("Opened %s\n", fname);
- free(wname);
- return f;
- }
-
- wsubdir = FromUTF8(subdir);
- if(!wsubdir)
- {
- ERR("Failed to convert UTF-8 subdir: \"%s\"\n", subdir);
- free(wname);
- return NULL;
- }
-
- for(i = 0;i < COUNTOF(ids);i++)
- {
- WCHAR buffer[PATH_MAX];
- size_t len;
-
- if(SHGetSpecialFolderPathW(NULL, buffer, ids[i], FALSE) == FALSE)
- continue;
-
- len = lstrlenW(buffer);
- if(len > 0 && is_slash(buffer[len-1]))
- buffer[--len] = '\0';
- _snwprintf(buffer+len, PATH_MAX-len, L"/%ls/%ls", wsubdir, wname);
- len = lstrlenW(buffer);
- while(len > 0)
- {
- --len;
- if(buffer[len] == '/')
- buffer[len] = '\\';
- }
-
- if((f=_wfopen(buffer, L"rb")) != NULL)
- {
- al_string filepath = AL_STRING_INIT_STATIC();
- al_string_copy_wcstr(&filepath, buffer);
- TRACE("Opened %s\n", al_string_get_cstr(filepath));
- al_string_deinit(&filepath);
- break;
- }
- }
- free(wname);
- free(wsubdir);
-
- if(f == NULL)
- WARN("Could not open %s\\%s\n", subdir, fname);
- return f;
-}
-
-
static size_t strlenW(const WCHAR *str)
{
const WCHAR *end = str;
@@ -955,77 +877,6 @@ void al_print(const char *type, const char *func, const char *fmt, ...)
}
-FILE *OpenDataFile(const char *fname, const char *subdir)
-{
- char buffer[PATH_MAX] = "";
- const char *str, *next;
- FILE *f;
-
- if(fname[0] == '/')
- {
- if((f=al_fopen(fname, "rb")) != NULL)
- {
- TRACE("Opened %s\n", fname);
- return f;
- }
- WARN("Could not open %s\n", fname);
- return NULL;
- }
-
- if((f=al_fopen(fname, "rb")) != NULL)
- {
- TRACE("Opened %s\n", fname);
- return f;
- }
-
- if((str=getenv("XDG_DATA_HOME")) != NULL && str[0] != '\0')
- snprintf(buffer, sizeof(buffer), "%s/%s/%s", str, subdir, fname);
- else if((str=getenv("HOME")) != NULL && str[0] != '\0')
- snprintf(buffer, sizeof(buffer), "%s/.local/share/%s/%s", str, subdir, fname);
- if(buffer[0])
- {
- if((f=al_fopen(buffer, "rb")) != NULL)
- {
- TRACE("Opened %s\n", buffer);
- return f;
- }
- }
-
- if((str=getenv("XDG_DATA_DIRS")) == NULL || str[0] == '\0')
- str = "/usr/local/share/:/usr/share/";
-
- next = str;
- while((str=next) != NULL && str[0] != '\0')
- {
- size_t len;
- next = strchr(str, ':');
-
- if(!next)
- len = strlen(str);
- else
- {
- len = next - str;
- next++;
- }
-
- if(len > sizeof(buffer)-1)
- len = sizeof(buffer)-1;
- strncpy(buffer, str, len);
- buffer[len] = '\0';
- snprintf(buffer+len, sizeof(buffer)-len, "/%s/%s", subdir, fname);
-
- if((f=al_fopen(buffer, "rb")) != NULL)
- {
- TRACE("Opened %s\n", buffer);
- return f;
- }
- }
- WARN("Could not open %s/%s\n", subdir, fname);
-
- return NULL;
-}
-
-
static int MatchFilter(const char *name, const char *match)
{
int ret = 1;