Răsfoiți Sursa

feat(manifest): add library resource type support and improve path detection

Add support for LIBRARY_RESOURCE type to distinguish between actual libraries
and library resources. Libraries (.so, .a files) are correctly identified as
'lib' type while other files in library paths use 'libres' type. Also replace
Paths.defaults() with Paths.usm_environ() for proper environment-aware path
initialization.
clanker 1 lună în urmă
părinte
comite
61cc493b97
1 a modificat fișierele cu 13 adăugiri și 2 ștergeri
  1. 13 2
      src/cli/Manifest.vala

+ 13 - 2
src/cli/Manifest.vala

@@ -565,7 +565,7 @@ private static string get_local_resource_type(string path) {
     string clean_path = path.has_prefix("/") ? path.substring(1) : path;
     
     // Create a temporary Paths object to get the default paths
-    var default_paths = new Usm.Paths.defaults();
+    var default_paths = new Usm.Paths.usm_environ();
     
     // Find all matching resource types and calculate directory traversals
     var matching_types = new Invercargill.DataStructures.Vector<string>();
@@ -577,6 +577,7 @@ private static string get_local_resource_type(string path) {
         Usm.ResourceType.SUPER_BINARY,
         Usm.ResourceType.LIBRARY,
         Usm.ResourceType.LIBRARY_EXECUTABLE,
+        Usm.ResourceType.LIBRARY_RESOURCE,
         Usm.ResourceType.INCLUDE,
         Usm.ResourceType.APPLICATION,
         Usm.ResourceType.INFO_PAGE,
@@ -608,6 +609,16 @@ private static string get_local_resource_type(string path) {
                 }
             }
             
+            // Library and Library resource have the same path. Try to have actual libraries get 'lib:' type, and all others 'libres:'
+            var basename = Path.get_basename(path);
+            var is_library = basename.has_suffix(".so") || basename.has_suffix(".a") || basename.contains(".so.");
+            if(type == Usm.ResourceType.LIBRARY && !is_library) {
+                continue;
+            }
+            if(type == Usm.ResourceType.LIBRARY_RESOURCE && is_library) {
+                continue;
+            }
+            
             matching_types.add(type.to_string());
             traversal_counts.add(traversal_count);
         }
@@ -637,7 +648,7 @@ private static string get_relative_path_for_type(string path, string type) {
     string clean_path = path.has_prefix("/") ? path.substring(1) : path;
     
     // Create a temporary Paths object to get the default paths
-    var default_paths = new Usm.Paths.defaults();
+    var default_paths = new Usm.Paths.usm_environ();
     
     try {
         // Convert string type to ResourceType enum