Esempio n. 1
0
char *Bgetsupportdir(int global)
{
#ifndef __APPLE__
	return Bgethomedir();
#else
#if LOWANG_IOS
    return Bgethomedir();
#else
	FSRef ref;
	CFStringRef str;
	CFURLRef base;
	char *s;
	
	if (FSFindFolder(global ? kLocalDomain : kUserDomain,
					 kApplicationSupportFolderType,
					 kDontCreateFolder, &ref) < 0) return NULL;
	base = CFURLCreateFromFSRef(NULL, &ref);
	if (!base) return NULL;
	str = CFURLCopyFileSystemPath(base, kCFURLPOSIXPathStyle);
	CFRelease(base);
	if (!str) return NULL;
	s = (char*)CFStringGetCStringPtr(str,CFStringGetSystemEncoding());
	if (s) s = strdup(s);
	CFRelease(str);
	return s;
#endif
#endif
}
Esempio n. 2
0
static unsigned char GetModsDirNames(GtkListStore *list)
{
    char *homedir;
    char pdir[BMAX_PATH];
    unsigned char iternumb = 0;
    CACHE1D_FIND_REC *dirs = NULL;
    GtkTreeIter iter;

    pathsearchmode = 1;

    if ((homedir = Bgethomedir()))
    {
        Bsnprintf(pdir, sizeof(pdir), "%s/" ".eduke32", homedir);
        dirs = klistpath(pdir, "*", CACHE1D_FIND_DIR);
        for (dirs=dirs; dirs != NULL; dirs=dirs->next)
        {
            if ((Bstrcmp(dirs->name, "autoload") == 0) ||
                    (Bstrcmp(dirs->name, "..") == 0) ||
                    (Bstrcmp(dirs->name, ".") == 0))
                continue;
            else
            {
                gtk_list_store_append(list, &iter);
                gtk_list_store_set(list, &iter, 0,dirs->name, -1);
                iternumb++;
            }
        }
    }

    klistfree(dirs);
    dirs = NULL;

    return iternumb;
}
Esempio n. 3
0
/**
 * Get the location for global or user-local support files.
 * @return NULL if it could not be determined
 */
char *Bgetsupportdir(int global)
{
    char *dir = NULL;
    
#ifdef __APPLE__
	FSRef ref;
	CFStringRef str;
	CFURLRef base;
	const char *s;
	
	if (FSFindFolder(global ? kLocalDomain : kUserDomain,
					 kApplicationSupportFolderType,
					 kDontCreateFolder, &ref) < 0) return NULL;

	base = CFURLCreateFromFSRef(NULL, &ref);
	if (!base) {
        return NULL;
    }
    
	str = CFURLCopyFileSystemPath(base, kCFURLPOSIXPathStyle);
	CFRelease(base);
	if (!str) {
        return NULL;
    }
    
	s = CFStringGetCStringPtr(str, CFStringGetSystemEncoding());
	if (s) {
        dir = strdup(s);
    }
	CFRelease(str);

#else
    if (!global) {
        dir = Bgethomedir();
    }
#endif
    
	return dir;
}