File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ edition = "2021"
66# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77
88[dependencies ]
9+ opener = " 0.6.1"
910powershell_script = " 1.1.0"
1011rand = " 0.8"
1112reqwest = { version = " 0.11.0" , features = [" blocking" ] }
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ use powershell_script::PsScriptBuilder;
22use rand:: seq:: SliceRandom ;
33use std:: collections:: HashMap ;
44use std:: env;
5+ use opener;
56use std:: fs:: File ;
67use std:: io:: { self , Error , Read , Write } ;
78use std:: thread;
@@ -866,20 +867,7 @@ impl Executor {
866867
867868 // ファイルを開く
868869 "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 ( ) ) ;
883871 }
884872
885873 // シェルコマンドを実行
You can’t perform that action at this time.
0 commit comments