File tree 1 file changed +45
-0
lines changed
1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,9 @@ pub use windows::{that, with};
55
55
#[ cfg( target_os = "macos" ) ]
56
56
pub use macos:: { that, with} ;
57
57
58
+ #[ cfg( target_os = "ios" ) ]
59
+ pub use ios:: { that, with} ;
60
+
58
61
#[ cfg( any(
59
62
target_os = "linux" ,
60
63
target_os = "android" ,
@@ -66,6 +69,19 @@ pub use macos::{that, with};
66
69
) ) ]
67
70
pub use unix:: { that, with} ;
68
71
72
+ #[ cfg( not( any(
73
+ target_os = "dragonfly" ,
74
+ target_os = "freebsd" ,
75
+ target_os = "ios" ,
76
+ target_os = "linux" ,
77
+ target_os = "macos" ,
78
+ target_os = "netbsd" ,
79
+ target_os = "openbsd" ,
80
+ target_os = "solaris" ,
81
+ target_os = "windows" ,
82
+ ) ) ) ]
83
+ compile_error ! ( "open is not supported on this platform" ) ;
84
+
69
85
/// Convenience function for opening the passed path in a new thread.
70
86
/// See documentation of `that(...)` for more details.
71
87
pub fn that_in_background < T : AsRef < OsStr > + Sized > (
@@ -187,6 +203,35 @@ mod macos {
187
203
}
188
204
}
189
205
206
+ #[ cfg( target_os = "ios" ) ]
207
+ mod ios {
208
+ use std:: {
209
+ ffi:: OsStr ,
210
+ io:: Result ,
211
+ process:: { Command , ExitStatus , Stdio } ,
212
+ } ;
213
+
214
+ pub fn that < T : AsRef < OsStr > + Sized > ( path : T ) -> Result < ExitStatus > {
215
+ Command :: new ( "uiopen" )
216
+ . stdout ( Stdio :: null ( ) )
217
+ . stderr ( Stdio :: null ( ) )
218
+ . arg ( "--url" )
219
+ . arg ( path. as_ref ( ) )
220
+ . spawn ( ) ?
221
+ . wait ( )
222
+ }
223
+
224
+ pub fn with < T : AsRef < OsStr > + Sized > ( path : T , app : impl Into < String > ) -> Result < ExitStatus > {
225
+ Command :: new ( "uiopen" )
226
+ . arg ( "--url" )
227
+ . arg ( path. as_ref ( ) )
228
+ . arg ( "--bundleid" )
229
+ . arg ( app. into ( ) )
230
+ . spawn ( ) ?
231
+ . wait ( )
232
+ }
233
+ }
234
+
190
235
#[ cfg( any(
191
236
target_os = "linux" ,
192
237
target_os = "android" ,
You can’t perform that action at this time.
0 commit comments