feat: 一键安装支持自选游戏目录
Some checks failed
Axolotl desktop CI / guardrails (push) Has been cancelled
Axolotl desktop CI / desktop (macos-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (ubuntu-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (windows-latest) (push) Has been cancelled
Axolotl desktop CI / website (push) Has been cancelled
Repository checks / typos (push) Has been cancelled
Repository checks / tombi (push) Has been cancelled
Rust checks / shear (push) Has been cancelled
Sync source to CNB / Sync Git ref (push) Has been cancelled
Some checks failed
Axolotl desktop CI / guardrails (push) Has been cancelled
Axolotl desktop CI / desktop (macos-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (ubuntu-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (windows-latest) (push) Has been cancelled
Axolotl desktop CI / website (push) Has been cancelled
Repository checks / typos (push) Has been cancelled
Repository checks / tombi (push) Has been cancelled
Rust checks / shear (push) Has been cancelled
Sync source to CNB / Sync Git ref (push) Has been cancelled
StarLight 实例一键安装此前固定落到启动器默认目录,无法选择游戏数据位置。 现复用创建流程的外部游戏目录能力:点击一键安装后弹出目录选择框, 只允许修改游戏目录,其余参数仍由服务器整合包决定。 - hosted::create 接受 game_dir_root,拼为 <root>/<包名> 作为 game_dir_override (刻意避开 versions/ 布局,该结构被外部直链实例检测占用) - 新增顶层命令 get_launcher_root_dir,作为弹窗默认值(可执行文件所在目录) - 新增 HostedGameDirModal 弹窗:只读路径框 + 浏览 + 默认位置 + 安装预览 - 补齐 en-US / zh-CN / zh-TW 三语文案 hosted_create 增加 game_dir_root 参数,前端 hostedCreate/install 同步透传。
This commit is contained in:
@ -426,10 +426,26 @@ pub async fn default_publication() -> crate::Result<Publication> {
|
||||
})
|
||||
}
|
||||
|
||||
pub async fn create() -> crate::Result<String> {
|
||||
pub async fn create(
|
||||
game_dir_root: Option<String>,
|
||||
) -> crate::Result<String> {
|
||||
let publication = default_publication().await?;
|
||||
let runtime = &publication.manifest.runtime;
|
||||
let state = State::get().await?;
|
||||
// The pack's game files live in their own folder under the chosen root,
|
||||
// e.g. `<root>/<pack name>`. Avoid a `versions/<name>` layout: that shape
|
||||
// is reserved for externally linked launcher instances and would make the
|
||||
// launcher expect a Minecraft version JSON beside the pack.
|
||||
let game_dir_override = game_dir_root
|
||||
.as_deref()
|
||||
.map(str::trim)
|
||||
.filter(|root| !root.is_empty())
|
||||
.map(|root| {
|
||||
Path::new(root)
|
||||
.join(&publication.manifest.name)
|
||||
.to_string_lossy()
|
||||
.into_owned()
|
||||
});
|
||||
let instance = crate::state::create_instance(
|
||||
crate::state::CreateInstance {
|
||||
name: publication.manifest.name.clone(),
|
||||
@ -440,7 +456,7 @@ pub async fn create() -> crate::Result<String> {
|
||||
icon_path: None,
|
||||
link: crate::state::InstanceLink::Unmanaged,
|
||||
symlink_target: None,
|
||||
game_dir_override: None,
|
||||
game_dir_override,
|
||||
},
|
||||
&state,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user