diff --git a/Cargo.lock b/Cargo.lock index b49825d..b1e70f4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3646,6 +3646,25 @@ dependencies = [ "mach2", ] +[[package]] +name = "is-docker" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3" +dependencies = [ + "once_cell", +] + +[[package]] +name = "is-wsl" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5" +dependencies = [ + "is-docker", + "once_cell", +] + [[package]] name = "is_terminal_polyfill" version = "1.70.0" @@ -4534,6 +4553,17 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "open" +version = "5.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2483562e62ea94312f3576a7aca397306df7990b8d89033e18766744377ef95" +dependencies = [ + "is-wsl", + "libc", + "pathdiff", +] + [[package]] name = "orbclient" version = "0.3.47" @@ -4609,6 +4639,12 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" +[[package]] +name = "pathdiff" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3" + [[package]] name = "pbkdf2" version = "0.12.2" @@ -4664,6 +4700,7 @@ dependencies = [ "log", "num", "num_enum", + "open", "phichain-assets", "phichain-chart", "phichain-compiler", diff --git a/phichain-editor/Cargo.toml b/phichain-editor/Cargo.toml index d234e1e..46e18d9 100644 --- a/phichain-editor/Cargo.toml +++ b/phichain-editor/Cargo.toml @@ -87,3 +87,4 @@ rand = "0.8.5" bon = "3.0.1" indexmap = "2.7.0" egui-phosphor = "0.5.0" +open = "5.3.2" diff --git a/phichain-editor/lang/en_us.yml b/phichain-editor/lang/en_us.yml index a38cf1d..23d2ec1 100644 --- a/phichain-editor/lang/en_us.yml +++ b/phichain-editor/lang/en_us.yml @@ -226,3 +226,5 @@ action: phichain.export_as_official: Export as Official phichain.create_line: Create Line + + phichain.open_in_file_manager: Open Project in File Manager diff --git a/phichain-editor/lang/zh_cn.yml b/phichain-editor/lang/zh_cn.yml index 5dede5c..b6b834b 100644 --- a/phichain-editor/lang/zh_cn.yml +++ b/phichain-editor/lang/zh_cn.yml @@ -226,3 +226,5 @@ action: phichain.export_as_official: 导出为官谱 phichain.create_line: 新建判定线 + + phichain.open_in_file_manager: 在文件管理器中打开项目 diff --git a/phichain-editor/src/project.rs b/phichain-editor/src/project.rs index 136da01..6d4d10d 100644 --- a/phichain-editor/src/project.rs +++ b/phichain-editor/src/project.rs @@ -47,6 +47,13 @@ impl Plugin for ProjectPlugin { events.send(UnloadProjectEvent); }, Some(Hotkey::new(KeyCode::KeyW, vec![Modifier::Control])), + ) + .add_action( + "phichain.open_in_file_manager", + |project: Res| { + let _ = open::that(project.path.0.clone()); + }, + None, ); } }