diff --git a/.github/workflows/tauri.yml b/.github/workflows/tauri.yml index 3b25bd3..d9e3255 100644 --- a/.github/workflows/tauri.yml +++ b/.github/workflows/tauri.yml @@ -51,17 +51,11 @@ jobs: uses: actions/cache@v4 with: path: | - ${{ env.VCPKG_ROOT }}/installed ${{ env.VCPKG_ROOT }}/downloads ${{ env.VCPKG_ROOT }}/packages + ${{ env.VCPKG_ROOT }}/installed key: ${{ runner.os }}-vcpkg-libarchive - - uses: actions/upload-artifact@v4 - with: - name: vcpkg - path: ${{ env.VCPKG_ROOT }}/installed - - - name: Install Vcpkg if: matrix.platform == 'windows-latest' run: "'${{env.VCPKG_ROOT}}/vcpkg' install libarchive:x64-windows-static-md" diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index b8e4cc6..339eb33 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -49,7 +49,7 @@ checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" [[package]] name = "android-x86-installer" -version = "0.1.5" +version = "0.1.6" dependencies = [ "compress-tools", "fs_extra", @@ -1700,13 +1700,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] -name = "open" -version = "3.2.0" +name = "os_info" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2078c0039e6a54a0c42c28faa984e115fb4c2d5bf2208f77d1961002df8576f8" +checksum = "006e42d5b888366f1880eda20371fedde764ed2213dc8496f49622fa0c99cd5e" dependencies = [ - "pathdiff", - "windows-sys 0.42.0", + "log", + "serde", + "winapi", ] [[package]] @@ -1773,12 +1774,6 @@ dependencies = [ "windows-targets 0.48.5", ] -[[package]] -name = "pathdiff" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" - [[package]] name = "percent-encoding" version = "2.3.1" @@ -2588,6 +2583,19 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sys-locale" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8a11bd9c338fdba09f7881ab41551932ad42e405f61d01e8406baea71c07aee" +dependencies = [ + "js-sys", + "libc", + "wasm-bindgen", + "web-sys", + "windows-sys 0.45.0", +] + [[package]] name = "system-deps" version = "5.0.0" @@ -2711,12 +2719,11 @@ dependencies = [ "ignore", "objc", "once_cell", - "open", + "os_info", "os_pipe", "percent-encoding", "rand 0.8.5", "raw-window-handle", - "regex", "rfd", "semver", "serde", @@ -2725,6 +2732,7 @@ dependencies = [ "serialize-to-javascript", "shared_child", "state", + "sys-locale", "tar", "tauri-macros", "tauri-runtime", @@ -2773,7 +2781,6 @@ dependencies = [ "png", "proc-macro2", "quote", - "regex", "semver", "serde", "serde_json", @@ -3552,17 +3559,11 @@ dependencies = [ [[package]] name = "windows-sys" -version = "0.42.0" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "windows-targets 0.42.2", ] [[package]] @@ -3583,6 +3584,21 @@ dependencies = [ "windows-targets 0.52.3", ] +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + [[package]] name = "windows-targets" version = "0.48.5" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 736f08e..4223f04 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -15,7 +15,7 @@ tauri-build = { version = "1.5", features = [] } [dependencies] serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } -tauri = { version = "1.5", features = ["dialog-open", "path-all", "process-exit", "shell-open", "process-command-api"] } +tauri = { version = "1.5", features = [ "os-all", "dialog-open", "path-all", "process-exit", "process-command-api"] } compress-tools = "0.14.3" fs_extra = "1.3.0" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 159b528..422a483 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -30,6 +30,9 @@ }, "path": { "all": true + }, + "os": { + "all": true } }, "bundle": { diff --git a/src/installer_app.js b/src/installer_app.js index 22b226b..7c0ff39 100644 --- a/src/installer_app.js +++ b/src/installer_app.js @@ -14,6 +14,7 @@ import { msg } from '@lit/localize' import { exit } from '@tauri-apps/api/process'; import androidLogo from './assets/android.svg' +import { type } from '@tauri-apps/api/os'; export class InstallerApp extends LitElement { @@ -29,6 +30,7 @@ export class InstallerApp extends LitElement { dataImgSize: {type: Number}, dataImgScale: {type: Number}, qemuConfigDone: {type: Boolean}, + osType: {type: String}, }; constructor() { @@ -199,7 +201,7 @@ export class InstallerApp extends LitElement { @@ -384,7 +386,8 @@ export class InstallerApp extends LitElement { this.dataDirSwitchEl.selected = false; this.dataImgSwitchState(); } - this.dataDirSwitchEl.disabled = this.dataImgSwitchEl.disabled = installForQemu; + if (this.osType != 'Windows_NT') + this.dataDirSwitchEl.disabled = this.dataImgSwitchEl.disabled = installForQemu; } onQemuConfigDoneButtonClicked() { @@ -429,6 +432,15 @@ export class InstallerApp extends LitElement { this.dataImgSwitchEl = this.renderRoot.querySelector('#data-img-switch'); this.qemuInstallSwitchEl = this.renderRoot.querySelector('#qemu-install-switch'); this.showDialog('', '"The Android robot is reproduced or modified from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License."'); + type().then((osType) => { + this.osType = osType; + if (this.osType == 'Windows_NT') { + this.dataImgSwitchEl.selected = true; + this.dataDirSwitchEl.selected = false; + this.dataDirSwitchEl.disabled = true; + this.dataImgSwitchState(); + } + }) } } diff --git a/src/main.js b/src/main.js index ceb608d..32c9037 100644 --- a/src/main.js +++ b/src/main.js @@ -52,16 +52,6 @@ async function startInstall() { }); } - -async function createGrubEntry() { - installEl.bootloaderMsg_ = await invoke("create_grub_entry", { - installDir: _installDir, - osTitle: osTitleTextFieldEl.value, - }); - installEl.installDir = _installDir; - installEl.activateNextCategory(); -} - async function updateProgress() { while(true) { await listen('new-dir-size', (event) => { @@ -70,6 +60,8 @@ async function updateProgress() { if (installEl.progressPercent_ == 100) { installEl.activeCategory_ = 'data_img_progress'; + if (installEl.osType == 'Windows_NT') installEl.useDataImg = true; + if (!installEl.useDataImg) { await createGrubEntry(); } else { @@ -86,6 +78,18 @@ async function updateProgress() { } } +async function createGrubEntry() { + const _installDir = installDirTextFieldEl.value; + installEl.bootloaderMsg_ = await invoke("create_grub_entry", { + installDir: _installDir, + osTitle: osTitleTextFieldEl.value, + }); + installEl.installDir = _installDir; + sidePanelEl.activateNextCategory(); + if (installEl.osType == 'Windows_NT') + installEl.activeCategory_ = 'qemu_settings'; +} + function toggleDarkMode() { if (!darkModeToggleEl.selected) { document.documentElement.setAttribute("light_mode", true);