File tree Expand file tree Collapse file tree 2 files changed +3
-14
lines changed Expand file tree Collapse file tree 2 files changed +3
-14
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ edition = "2021"
6
6
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7
7
8
8
[dependencies ]
9
+ opener = " 0.6.1"
9
10
powershell_script = " 1.1.0"
10
11
rand = " 0.8"
11
12
reqwest = { version = " 0.11.0" , features = [" blocking" ] }
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ use powershell_script::PsScriptBuilder;
2
2
use rand:: seq:: SliceRandom ;
3
3
use std:: collections:: HashMap ;
4
4
use std:: env;
5
+ use opener;
5
6
use std:: fs:: File ;
6
7
use std:: io:: { self , Error , Read , Write } ;
7
8
use std:: thread;
@@ -866,20 +867,7 @@ impl Executor {
866
867
867
868
// ファイルを開く
868
869
"open" => {
869
- if cfg ! ( target_os = "windows" ) {
870
- let _result = std:: process:: Command :: new ( "cmd" )
871
- . args ( & [ "/C" , "start" , "" , self . pop_stack ( ) . get_string ( ) . as_str ( ) ] )
872
- . spawn ( ) ;
873
- } else if cfg ! ( target_os = "linux" ) {
874
- let _result =
875
- std:: process:: Command :: new ( "xdg-open" ) // Linuxの場合
876
- . arg ( self . pop_stack ( ) . get_string ( ) . as_str ( ) )
877
- . spawn ( ) ;
878
- } else if cfg ! ( target_os = "macos" ) {
879
- let _result = std:: process:: Command :: new ( "open" )
880
- . arg ( self . pop_stack ( ) . get_string ( ) . as_str ( ) )
881
- . spawn ( ) ;
882
- }
870
+ let _result = opener:: open ( self . pop_stack ( ) . get_string ( ) ) ;
883
871
}
884
872
885
873
// シェルコマンドを実行
You can’t perform that action at this time.
0 commit comments