Commit bbb43033 authored by Alexandre Julliard's avatar Alexandre Julliard

winecfg: Support for loading the list of dlls from the build directory.

parent 4db364cb
...@@ -32,6 +32,9 @@ ...@@ -32,6 +32,9 @@
#include <dirent.h> #include <dirent.h>
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
...@@ -252,38 +255,63 @@ static int is_16bit_dll( const char *dir, const char *name ) ...@@ -252,38 +255,63 @@ static int is_16bit_dll( const char *dir, const char *name )
} }
/* load the list of available libraries from a given dir */ /* load the list of available libraries from a given dir */
static void load_library_list_from_dir( HWND dialog, const char *dir_path ) static void load_library_list_from_dir( HWND dialog, const char *dir_path, int check_subdirs )
{ {
char name[256]; char *buffer = NULL, name[256];
struct dirent *de; struct dirent *de;
DIR *dir = opendir( dir_path ); DIR *dir = opendir( dir_path );
if (!dir) return; if (!dir) return;
if (check_subdirs)
buffer = HeapAlloc( GetProcessHeap(), 0, strlen(dir_path) + 2 * sizeof(name) + 10 );
while ((de = readdir( dir ))) while ((de = readdir( dir )))
{ {
size_t len = strlen(de->d_name); size_t len = strlen(de->d_name);
if (len > sizeof(name) || len <= 7 || strcmp( de->d_name + len - 7, ".dll.so")) continue; if (len > sizeof(name)) continue;
if (is_16bit_dll( dir_path, de->d_name )) continue; /* 16-bit dlls can't be configured */ if (len > 7 && !strcmp( de->d_name + len - 7, ".dll.so"))
len -= 7; {
memcpy( name, de->d_name, len ); if (is_16bit_dll( dir_path, de->d_name )) continue; /* 16-bit dlls can't be configured */
name[len] = 0; len -= 7;
/* skip dlls that should always be builtin */ memcpy( name, de->d_name, len );
if (is_builtin_only( name )) continue; name[len] = 0;
SendDlgItemMessageA( dialog, IDC_DLLCOMBO, CB_ADDSTRING, 0, (LPARAM)name ); /* skip dlls that should always be builtin */
if (is_builtin_only( name )) continue;
SendDlgItemMessageA( dialog, IDC_DLLCOMBO, CB_ADDSTRING, 0, (LPARAM)name );
}
else if (check_subdirs)
{
struct stat st;
if (is_builtin_only( de->d_name )) continue;
sprintf( buffer, "%s/%s/%s.dll.so", dir_path, de->d_name, de->d_name );
if (!stat( buffer, &st ))
SendDlgItemMessageA( dialog, IDC_DLLCOMBO, CB_ADDSTRING, 0, (LPARAM)de->d_name );
}
} }
closedir( dir ); closedir( dir );
HeapFree( GetProcessHeap(), 0, buffer );
} }
/* load the list of available libraries */ /* load the list of available libraries */
static void load_library_list( HWND dialog ) static void load_library_list( HWND dialog )
{ {
unsigned int i = 0; unsigned int i = 0;
const char *path; const char *path, *build_dir = wine_get_build_dir();
char item1[256], item2[256]; char item1[256], item2[256];
HCURSOR old_cursor = SetCursor( LoadCursor(0, IDC_WAIT) );
if (build_dir)
{
char *dir = HeapAlloc( GetProcessHeap(), 0, strlen(build_dir) + sizeof("/dlls") );
strcpy( dir, build_dir );
strcat( dir, "/dlls" );
load_library_list_from_dir( dialog, dir, TRUE );
HeapFree( GetProcessHeap(), 0, dir );
}
while ((path = wine_dll_enum_load_path( i++ ))) while ((path = wine_dll_enum_load_path( i++ )))
load_library_list_from_dir( dialog, path ); load_library_list_from_dir( dialog, path, FALSE );
/* get rid of duplicate entries */ /* get rid of duplicate entries */
...@@ -301,6 +329,7 @@ static void load_library_list( HWND dialog ) ...@@ -301,6 +329,7 @@ static void load_library_list( HWND dialog )
i++; i++;
} }
} }
SetCursor( old_cursor );
} }
static void load_library_settings(HWND dialog) static void load_library_settings(HWND dialog)
......
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