cocoafile 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e19e0b889d1901951c25e1e6d12ad3fbb177091b28cfd52293b4d023369820a0
4
- data.tar.gz: eda391282ad5c71d4807e240fee73fc83bfca0438fdcd49fba62ee428326c8ac
3
+ metadata.gz: 89ec401c700f2fba2bd533d092ee68342c3cc826ce485e343f27e3a1ba2d82c5
4
+ data.tar.gz: 2158ace3a8f5e65eb295d12429a1e62bd8d2744a41dbf984580bd847f2dd705e
5
5
  SHA512:
6
- metadata.gz: 55a58dfce9a2872e9febc0dcaf3d2691b2fe37a088fd627da0c3cf6301e10bd320aaa8080aaf879d0481c2b7abbbdbe81b482ea6d110f23a01e2c225d43d8aac
7
- data.tar.gz: ee86404f0f54693f4f3f86becfc995de79f1d549a469e44676aba3782d15ccad0c33ca0e1ea9963a8eef6359eaced1e692e6a44ab238657e02643d3546164891
6
+ metadata.gz: 4bd587c520f681a7afd62ddbc7fe85b5ef07d612c36e4cb8530668dee812d9b76af711a2deddb83d631666df8db25e1a47c14bb87db16c6332452df7cdcc5d62
7
+ data.tar.gz: 4e0b8c6b167179fc54e84e84ab217ca2139e0cf13533e5f24683b58040b371b777f0e0e39e3207e443b828c6d034aa1b71cfc0e6225b8c1479c70be4ce45a289
@@ -15,14 +15,28 @@ Init_cocoafile(void)
15
15
  }
16
16
 
17
17
  VALUE choose_file(VALUE self, VALUE rb_ext) {
18
- // Convert Ruby string to NSString
19
- Check_Type(rb_ext, T_STRING);
20
- const char *ext_cstr = StringValueCStr(rb_ext);
21
- NSString *ext = [NSString stringWithUTF8String:ext_cstr];
18
+ // Ensure the input is an array of strings
19
+ Check_Type(rb_ext, T_ARRAY);
20
+ NSMutableArray *extensions = [NSMutableArray array];
21
+
22
+ // Convert each Ruby string (extension) to NSString and add to the list
23
+ long len = RARRAY_LEN(rb_ext);
24
+ for (long i = 0; i < len; i++) {
25
+ VALUE ext_val = rb_ary_entry(rb_ext, i);
26
+ Check_Type(ext_val, T_STRING);
27
+ const char *ext_cstr = StringValueCStr(ext_val);
28
+ NSString *ext = [NSString stringWithUTF8String:ext_cstr];
29
+
30
+ UTType *lumioseType = [UTType typeWithFilenameExtension:ext];
31
+ if (lumioseType) {
32
+ [extensions addObject:lumioseType];
33
+ }
34
+ }
35
+
36
+
22
37
  NSOpenPanel *panel = [NSOpenPanel openPanel];
23
38
 
24
- UTType *lumioseType = [UTType typeWithFilenameExtension:ext];
25
- panel.allowedContentTypes = @[lumioseType];
39
+ panel.allowedContentTypes = extensions;
26
40
  panel.canChooseFiles = YES;
27
41
  panel.canChooseDirectories = NO;
28
42
  panel.allowsMultipleSelection = NO;
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cocoafile
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoafile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tommy Jeff
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-12-04 00:00:00.000000000 Z
10
+ date: 2025-12-11 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: Choosing file with NSPanel
13
13
  email: