| ... | @@ -7094,7 +7094,7 @@ pub fn hasSharedLibraryExt(filename: []const u8) bool { | ... | @@ -7094,7 +7094,7 @@ pub fn hasSharedLibraryExt(filename: []const u8) bool { |
| 7094 | { | 7094 | { |
| 7095 | return true; | 7095 | return true; |
| 7096 | } | 7096 | } |
| 7097 | // Look for .so.X, .so.X.Y, .so.X.Y.Z | 7097 | // Look for .so.X, .so.X.Y, .so.X.Y.Z.* |
| 7098 | var it = mem.splitScalar(u8, filename, '.'); | 7098 | var it = mem.splitScalar(u8, filename, '.'); |
| 7099 | _ = it.first(); | 7099 | _ = it.first(); |
| 7100 | var so_txt = it.next() orelse return false; | 7100 | var so_txt = it.next() orelse return false; |
| ... | @@ -7108,7 +7108,6 @@ pub fn hasSharedLibraryExt(filename: []const u8) bool { | ... | @@ -7108,7 +7108,6 @@ pub fn hasSharedLibraryExt(filename: []const u8) bool { |
| 7108 | _ = std.fmt.parseInt(u32, n1, 10) catch return false; | 7108 | _ = std.fmt.parseInt(u32, n1, 10) catch return false; |
| 7109 | if (n2) |x| _ = std.fmt.parseInt(u32, x, 10) catch return false; | 7109 | if (n2) |x| _ = std.fmt.parseInt(u32, x, 10) catch return false; |
| 7110 | if (n3) |x| _ = std.fmt.parseInt(u32, x, 10) catch return false; | 7110 | if (n3) |x| _ = std.fmt.parseInt(u32, x, 10) catch return false; |
| 7111 | if (it.next() != null) return false; | | |
| 7112 | | 7111 | |
| 7113 | return true; | 7112 | return true; |
| 7114 | } | 7113 | } |
| ... | @@ -7140,8 +7139,6 @@ pub fn classifyFileExt(filename: []const u8) FileExt { | ... | @@ -7140,8 +7139,6 @@ pub fn classifyFileExt(filename: []const u8) FileExt { |
| 7140 | return .assembly_with_cpp; | 7139 | return .assembly_with_cpp; |
| 7141 | } else if (mem.endsWith(u8, filename, ".zig")) { | 7140 | } else if (mem.endsWith(u8, filename, ".zig")) { |
| 7142 | return .zig; | 7141 | return .zig; |
| 7143 | } else if (hasSharedLibraryExt(filename)) { | | |
| 7144 | return .shared_library; | | |
| 7145 | } else if (hasStaticLibraryExt(filename)) { | 7142 | } else if (hasStaticLibraryExt(filename)) { |
| 7146 | return .static_library; | 7143 | return .static_library; |
| 7147 | } else if (hasObjectExt(filename)) { | 7144 | } else if (hasObjectExt(filename)) { |
| ... | @@ -7154,6 +7151,8 @@ pub fn classifyFileExt(filename: []const u8) FileExt { | ... | @@ -7154,6 +7151,8 @@ pub fn classifyFileExt(filename: []const u8) FileExt { |
| 7154 | return .res; | 7151 | return .res; |
| 7155 | } else if (std.ascii.endsWithIgnoreCase(filename, ".manifest")) { | 7152 | } else if (std.ascii.endsWithIgnoreCase(filename, ".manifest")) { |
| 7156 | return .manifest; | 7153 | return .manifest; |
| | 7154 | } else if (hasSharedLibraryExt(filename)) { // currently the only check that doesn't only look at the end, thus goes last |
| | 7155 | return .shared_library; |
| 7157 | } else { | 7156 | } else { |
| 7158 | return .unknown; | 7157 | return .unknown; |
| 7159 | } | 7158 | } |
| ... | @@ -7168,7 +7167,9 @@ test "classifyFileExt" { | ... | @@ -7168,7 +7167,9 @@ test "classifyFileExt" { |
| 7168 | try std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so.1")); | 7167 | try std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so.1")); |
| 7169 | try std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so.1.2")); | 7168 | try std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so.1.2")); |
| 7170 | try std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so.1.2.3")); | 7169 | try std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so.1.2.3")); |
| 7171 | try std.testing.expectEqual(FileExt.unknown, classifyFileExt("foo.so.1.2.3~")); | 7170 | try std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so.1.2.3.4")); |
| | 7171 | try std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so.1.2.3.dev4")); |
| | 7172 | try std.testing.expectEqual(FileExt.static_library, classifyFileExt("foo.so.1.a")); |
| 7172 | try std.testing.expectEqual(FileExt.zig, classifyFileExt("foo.zig")); | 7173 | try std.testing.expectEqual(FileExt.zig, classifyFileExt("foo.zig")); |
| 7173 | } | 7174 | } |
| 7174 | | 7175 | |