cocoafile 0.2.0 → 0.3.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 +4 -4
- data/ext/cocoafile/cocoafile.m +8 -4
- data/lib/cocoafile/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e19e0b889d1901951c25e1e6d12ad3fbb177091b28cfd52293b4d023369820a0
|
|
4
|
+
data.tar.gz: eda391282ad5c71d4807e240fee73fc83bfca0438fdcd49fba62ee428326c8ac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 55a58dfce9a2872e9febc0dcaf3d2691b2fe37a088fd627da0c3cf6301e10bd320aaa8080aaf879d0481c2b7abbbdbe81b482ea6d110f23a01e2c225d43d8aac
|
|
7
|
+
data.tar.gz: ee86404f0f54693f4f3f86becfc995de79f1d549a469e44676aba3782d15ccad0c33ca0e1ea9963a8eef6359eaced1e692e6a44ab238657e02643d3546164891
|
data/ext/cocoafile/cocoafile.m
CHANGED
|
@@ -4,20 +4,24 @@
|
|
|
4
4
|
VALUE rb_mCocoafile;
|
|
5
5
|
VALUE rb_mFile;
|
|
6
6
|
|
|
7
|
-
VALUE choose_file(VALUE self);
|
|
7
|
+
VALUE choose_file(VALUE self, VALUE rb_ext);
|
|
8
8
|
|
|
9
9
|
RUBY_FUNC_EXPORTED void
|
|
10
10
|
Init_cocoafile(void)
|
|
11
11
|
{
|
|
12
12
|
rb_mCocoafile = rb_define_module("Cocoafile");
|
|
13
13
|
rb_mFile = rb_define_class_under(rb_mCocoafile, "File", rb_cObject);
|
|
14
|
-
rb_define_method(rb_mFile, "choose_file", choose_file,
|
|
14
|
+
rb_define_method(rb_mFile, "choose_file", choose_file, 1);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
VALUE choose_file(VALUE self) {
|
|
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
22
|
NSOpenPanel *panel = [NSOpenPanel openPanel];
|
|
19
23
|
|
|
20
|
-
UTType *lumioseType = [UTType typeWithFilenameExtension
|
|
24
|
+
UTType *lumioseType = [UTType typeWithFilenameExtension:ext];
|
|
21
25
|
panel.allowedContentTypes = @[lumioseType];
|
|
22
26
|
panel.canChooseFiles = YES;
|
|
23
27
|
panel.canChooseDirectories = NO;
|
data/lib/cocoafile/version.rb
CHANGED