Dependency accounting is needed only under win32, but not under Unix-like systems.

This commit is contained in:
Kolan Sh 2018-06-21 18:38:36 +03:00
parent ee8c6209db
commit ae0f0e3153
2 changed files with 29 additions and 9 deletions

@ -1 +1 @@
Subproject commit ab63ce22a9e2d149d8843f49bd33f8116a862d39 Subproject commit 9ba1995060ebb1c65ac9855e3671b3992c859059

View File

@ -96,27 +96,37 @@ namespace GObject {
public bool load_modules (string dir_path, ref Gee.ArrayList<Module>? modules) { public bool load_modules (string dir_path, ref Gee.ArrayList<Module>? modules) {
modules = new Gee.ArrayList<Module> (); modules = new Gee.ArrayList<Module> ();
var paths = new Gee.HashSet<string> (); #if (WINDOWS)
var paths = new Gee.HashSet<string> ();
#endif
try { try {
var libPath = File.new_for_path (dir_path); var libPath = File.new_for_path (dir_path);
#if (WINDOWS)
for (var i = 0; i < 32; ++i) { for (var i = 0; i < 32; ++i) {
var saved_length = modules.size; var saved_length = modules.size;
#endif
var lib_enumerator = libPath.enumerate_children (FileAttribute.STANDARD_NAME, 0, null); var lib_enumerator = libPath.enumerate_children (FileAttribute.STANDARD_NAME, 0, null);
FileInfo file_info = null; FileInfo file_info = null;
while ((file_info = lib_enumerator.next_file (null)) != null) { while ((file_info = lib_enumerator.next_file (null)) != null) {
if (Regex.match_simple ("^.*\\.(so|dll)$", file_info.get_name ())) { if (Regex.match_simple ("^.*\\.(so|dll)$", file_info.get_name ())) {
var path = GLib.Module.build_path (dir_path, file_info.get_name ()); var path = GLib.Module.build_path (dir_path, file_info.get_name ());
if (paths.contains(path)) continue; #if (WINDOWS)
if (paths.contains(path)) continue;
#endif
var module = new Module (path); var module = new Module (path);
if (module.load ()) { if (module.load ()) {
modules.add (module); modules.add (module);
paths.add(path); #if (WINDOWS)
paths.add(path);
#endif
} }
} }
} }
#if (WINDOWS)
if (modules.size == saved_length) break; if (modules.size == saved_length) break;
} }
#endif
} catch (Error e) { } catch (Error e) {
message (e.message); message (e.message);
return false; return false;
@ -139,12 +149,16 @@ namespace GObject {
public bool load_modules_depth2 (string dir_path, ref Gee.ArrayList<Module>? modules) { public bool load_modules_depth2 (string dir_path, ref Gee.ArrayList<Module>? modules) {
modules = new Gee.ArrayList<Module> (); modules = new Gee.ArrayList<Module> ();
var paths = new Gee.HashSet<string> (); #if (WINDOWS)
var paths = new Gee.HashSet<string> ();
#endif
try { try {
var libPath = File.new_for_path (dir_path); var libPath = File.new_for_path (dir_path);
#if (WINDOWS)
for (var i = 0; i < 32; ++i) { for (var i = 0; i < 32; ++i) {
var saved_length = modules.size; var saved_length = modules.size;
#endif
var dir_enumerator = libPath.enumerate_children ("standard::*", var dir_enumerator = libPath.enumerate_children ("standard::*",
FileQueryInfoFlags.NOFOLLOW_SYMLINKS, null); FileQueryInfoFlags.NOFOLLOW_SYMLINKS, null);
FileInfo dir_info = null; FileInfo dir_info = null;
@ -157,18 +171,24 @@ namespace GObject {
if (Regex.match_simple ("^.*\\.(so|dll)$", file_info.get_name ())) { if (Regex.match_simple ("^.*\\.(so|dll)$", file_info.get_name ())) {
var path = Path.build_path (Path.DIR_SEPARATOR_S, dir_path, dir_info.get_name ()); var path = Path.build_path (Path.DIR_SEPARATOR_S, dir_path, dir_info.get_name ());
path = GLib.Module.build_path (path, file_info.get_name ()); path = GLib.Module.build_path (path, file_info.get_name ());
if (paths.contains(path)) continue; #if (WINDOWS)
if (paths.contains(path)) continue;
#endif
var module = new Module (path); var module = new Module (path);
if (module.load ()) { if (module.load ()) {
modules.add (module); modules.add (module);
paths.add(path); #if (WINDOWS)
paths.add(path);
#endif
} }
} }
} }
} }
} }
#if (WINDOWS)
if (modules.size == saved_length) break; if (modules.size == saved_length) break;
} }
#endif
} catch (Error e) { } catch (Error e) {
message (e.message); message (e.message);
return false; return false;