├── .editorconfig ├── .github ├── ISSUE_TEMPLATE │ └── bug_report.md └── workflows │ └── build.yml ├── .gitignore ├── .metadata ├── .vscode └── extensions.json ├── CHANGELOG.md ├── CHANGELOG_JP.md ├── LICENSE ├── README.md ├── README_JP.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── tiny_vcc │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── assets ├── images │ ├── app_icon-1024x1024.png │ └── app_icon_mac-1024x1024.png └── texts │ └── LICENSE_NOTICE ├── installer └── TinyVccInstaller │ ├── .gitignore │ ├── TinyVccInstaller.sln │ └── TinyVccInstaller │ ├── TinyVccInstaller.vdproj │ └── files.txt ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Podfile ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h ├── lib ├── caches │ └── simple_cache.dart ├── data │ ├── exceptions.dart │ ├── tiny_vcc_data.dart │ └── vcc_data.dart ├── globals.dart ├── i18n │ ├── strings.g.dart │ ├── strings.i18n.json │ ├── strings_ja.i18n.json │ ├── strings_ko.i18n.json │ └── strings_zh-CN.i18n.json ├── main.dart ├── main_drawer.dart ├── providers.dart ├── repos │ ├── requirements_repository.dart │ ├── tiny_vcc_settings_repository.dart │ ├── vcc_projects_repository.dart │ ├── vcc_settings_repository.dart │ ├── vcc_templates_repository.dart │ └── vpm_packages_repository.dart ├── routes │ ├── legacy_project_route.dart │ ├── main_route.dart │ ├── new_project_route.dart │ ├── project_route.dart │ └── requirements_route.dart ├── services │ ├── dotnet_service.dart │ ├── tiny_vcc_service.dart │ ├── unity_hub_service.dart │ ├── updater_service.dart │ └── vcc_service.dart ├── utils.dart ├── utils │ ├── file_output.dart │ ├── layout_util.dart │ ├── platform_feature.dart │ └── system_info.dart └── widgets │ ├── console_dialog.dart │ ├── copyable_text.dart │ ├── m3_speed_dial.dart │ ├── navigation_scaffold.dart │ ├── new_project_dialog.dart │ ├── new_project_form.dart │ ├── package_list_item.dart │ ├── projects_page.dart │ └── settings_page.dart ├── linux ├── .gitignore ├── CMakeLists.txt ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake ├── functions.cc ├── functions.h ├── main.cc ├── my_application.cc └── my_application.h ├── macos ├── .gitignore ├── Flutter │ ├── Flutter-Debug.xcconfig │ ├── Flutter-Release.xcconfig │ └── GeneratedPluginRegistrant.swift ├── Podfile ├── Podfile.lock ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── app_icon_1024.png │ │ ├── app_icon_128.png │ │ ├── app_icon_16.png │ │ ├── app_icon_256.png │ │ ├── app_icon_32.png │ │ ├── app_icon_512.png │ │ └── app_icon_64.png │ ├── Base.lproj │ └── MainMenu.xib │ ├── Configs │ ├── AppInfo.xcconfig │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── Warnings.xcconfig │ ├── DebugProfile.entitlements │ ├── Functions.swift │ ├── Info.plist │ ├── MainFlutterWindow.swift │ └── Release.entitlements ├── pubspec.lock ├── pubspec.yaml ├── scripts ├── bump-version.sh ├── create-dmg.sh ├── generate-releasenote.sh └── update-product-code.ps1 ├── slang.yaml ├── test ├── services │ └── unity_hub_service_test.dart ├── utils │ └── system_info_test.dart ├── widget_test.dart └── widgets │ └── new_project_form_test.dart ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── index.html └── manifest.json └── windows ├── .gitignore ├── CMakeLists.txt ├── flutter ├── CMakeLists.txt ├── generated_plugin_registrant.cc ├── generated_plugin_registrant.h └── generated_plugins.cmake └── runner ├── CMakeLists.txt ├── Runner.rc ├── flutter_window.cpp ├── flutter_window.h ├── functions.cpp ├── functions.h ├── main.cpp ├── resource.h ├── resources └── app_icon.ico ├── runner.exe.manifest ├── utils.cpp ├── utils.h ├── win32_window.cpp └── win32_window.h /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [lib/**.json] 4 | indent_style = space 5 | indext_size = 2 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS and Version [e.g. Windows 10 22H2] 28 | - Tiny VCC Version 29 | - VPM CLI Version (`vpm --version` in terminal) 30 | 31 | **Additional context** 32 | Add any other context about the problem here. 33 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | # Controls when the workflow will run 4 | on: 5 | push: 6 | # pull_request: 7 | 8 | workflow_dispatch: 9 | 10 | jobs: 11 | build-windows: 12 | runs-on: windows-latest 13 | steps: 14 | - uses: actions/checkout@v3 15 | - uses: subosito/flutter-action@v2 16 | with: 17 | flutter-version: '3.7.0' 18 | cache: true 19 | cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' 20 | cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:' 21 | - run: flutter config --enable-windows-desktop 22 | - run: flutter pub get 23 | - run: flutter pub run slang 24 | - run: flutter build windows 25 | - uses: actions/upload-artifact@v3 26 | with: 27 | name: windows 28 | path: build/windows/runner/Release 29 | 30 | build-msi: 31 | needs: [build-windows] 32 | runs-on: windows-latest 33 | steps: 34 | - uses: actions/checkout@v3 35 | - uses: actions/download-artifact@v3 36 | with: 37 | name: windows 38 | path: build/windows/runner/Release 39 | 40 | - run: ls -n -r .\\build\\windows\\runner\\Release > built-files.txt 41 | - run: diff (type .\\installer\\TinyVccInstaller\\TinyVccInstaller\\files.txt) (type built-files.txt) 42 | 43 | - uses: ilammy/msvc-dev-cmd@v1 44 | - run: devenv .\\installer\\TinyVccInstaller\\TinyVccInstaller.sln /build Release 45 | - uses: actions/upload-artifact@v3 46 | with: 47 | name: msi 48 | path: installer/TinyVccInstaller/TinyVccInstaller/Release 49 | 50 | build-macos: 51 | runs-on: macos-latest 52 | steps: 53 | - uses: actions/checkout@v3 54 | - uses: subosito/flutter-action@v2 55 | with: 56 | flutter-version: '3.7.0' 57 | cache: true 58 | cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' 59 | cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:' 60 | - run: flutter config --enable-macos-desktop 61 | - run: flutter pub get 62 | - run: flutter pub run slang 63 | - run: flutter test 64 | - run: flutter build macos 65 | - run: brew install create-dmg 66 | - run: ./scripts/create-dmg.sh "build/macos/Build/Products/Release/Tiny VCC.app" TinyVCC.dmg 67 | - uses: actions/upload-artifact@v3 68 | with: 69 | name: macos 70 | path: TinyVCC.dmg 71 | 72 | build-linux: 73 | runs-on: ubuntu-latest 74 | steps: 75 | - uses: actions/checkout@v3 76 | - uses: subosito/flutter-action@v2 77 | with: 78 | flutter-version: '3.7.0' 79 | cache: true 80 | cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' 81 | cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:' 82 | - run: | 83 | sudo apt-get update -y 84 | sudo apt-get install -y ninja-build libgtk-3-dev 85 | - run: flutter config --enable-linux-desktop 86 | - run: flutter pub get 87 | - run: flutter pub run slang 88 | - run: flutter build linux 89 | - uses: actions/upload-artifact@v3 90 | with: 91 | name: linux 92 | path: build/linux/x64/release/bundle 93 | 94 | test-unity-hub: 95 | runs-on: macos-latest 96 | steps: 97 | - run: uname -a 98 | - run: curl -L https://public-cdn.cloud.unity3d.com/hub/prod/UnityHubSetup.dmg -o UnityHubSetup.dmg 99 | - run: hdiutil mount UnityHubSetup.dmg 100 | - run: ls /Volumes 101 | - run: cp -r /Volumes/Unity\ Hub\ */Unity\ Hub.app /Applications/ 102 | - run: hdiutil unmount /Volumes/Unity\ Hub\ * 103 | - run: /Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless install --version 2019.4.31f1 -c bd5abf232a62 104 | - run: /Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless editors --installed 105 | 106 | test-unity-hub-m1: 107 | runs-on: macos-latest-xlarge 108 | if: false 109 | steps: 110 | - run: uname -a 111 | - run: curl -L https://public-cdn.cloud.unity3d.com/hub/prod/UnityHubSetup.dmg -o UnityHubSetup.dmg 112 | - run: hdiutil mount UnityHubSetup.dmg 113 | - run: ls /Volumes 114 | - run: cp -r /Volumes/Unity\ Hub\ */Unity\ Hub.app /Applications/ 115 | - run: hdiutil unmount /Volumes/Unity\ Hub\ * 116 | - run: /Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless install --version 2019.4.31f1 -c bd5abf232a62 --architecture arm64 117 | - run: /Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless editors --installed 118 | 119 | release: 120 | if: startsWith(github.ref, 'refs/tags/') 121 | needs: [build-msi, build-macos, build-linux] 122 | runs-on: ubuntu-latest 123 | steps: 124 | - uses: actions/checkout@v3 125 | 126 | - uses: actions/download-artifact@v3 127 | with: 128 | name: msi 129 | path: build/windows/runner/Release 130 | 131 | - uses: actions/download-artifact@v3 132 | with: 133 | name: macos 134 | 135 | - uses: actions/download-artifact@v3 136 | with: 137 | name: linux 138 | path: build/linux/x64/release/bundle 139 | 140 | - run: ls 141 | 142 | - name: Create windows release 143 | run: | 144 | NAME=tiny_vcc-${GITHUB_REF#refs/tags/} 145 | mv build/windows/runner/Release ${NAME} 146 | cp LICENSE* ${NAME}/ 147 | cp README*.md ${NAME}/ 148 | zip -r ${NAME}.zip ${NAME} 149 | 150 | - name: Create macos release 151 | run: mv TinyVCC.dmg TinyVCC-${GITHUB_REF#refs/tags/}.dmg 152 | 153 | - name: Create release note 154 | run: ./scripts/generate-releasenote.sh ${GITHUB_REF#refs/tags/v} | tee ${{ github.workspace }}-release.txt 155 | 156 | - uses: softprops/action-gh-release@v1 157 | with: 158 | draft: true 159 | body_path: ${{ github.workspace }}-release.txt 160 | files: | 161 | *.zip 162 | *.dmg 163 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Symbolication related 36 | app.*.symbols 37 | 38 | # Obfuscation related 39 | app.*.map.json 40 | 41 | # Android Studio will place build artifacts here 42 | /android/app/debug 43 | /android/app/profile 44 | /android/app/release 45 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled. 5 | 6 | version: 7 | revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 8 | channel: unknown 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 17 | base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 18 | - platform: android 19 | create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 20 | base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 21 | - platform: ios 22 | create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 23 | base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 24 | - platform: linux 25 | create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 26 | base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 27 | - platform: macos 28 | create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 29 | base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 30 | - platform: web 31 | create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 32 | base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 33 | - platform: windows 34 | create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 35 | base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "dart-code.flutter", 4 | "luanpotter.dart-import" 5 | ] 6 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 | 8 | ## [0.6.1] - 2023-12-06 9 | 10 | ### Fixed 11 | - Fix packages list may not properly appears. 12 | - Fix repositories not updated to the latest information. 13 | 14 | ## [0.6.0] - 2023-10-18 15 | 16 | ### Removed 17 | - Remove version pinning of VPM CLI installation. 18 | 19 | ### Fixed 20 | 21 | - [macOS] Fix Unity installation not working on Apple Silicon. 22 | - [Windows] Fix architecture detection not working on Windows 11 with AMD CPU. 23 | - Fix Unity path not properly saved even when manually selected. 24 | - Fix Unity version check 25 | 26 | ## [0.5.0] - 2023-10-01 27 | 28 | ### Added 29 | 30 | - Add Korean translation. (by [Kieaer](https://github.com/Kieaer)) 31 | 32 | ## [0.4.0] - 2023-03-21 33 | 34 | ### Added 35 | 36 | - Add dark theme. 37 | - Add Japanese translation. 38 | - Add Simplified Chinese translation. (by [Sonic853](https://github.com/Sonic853)) 39 | 40 | ### Changed 41 | 42 | - New layout for the main page. 43 | 44 | ## [0.3.0] - 2023-01-09 45 | 46 | ### Added 47 | 48 | - Automate installation of required software. 49 | - [Windows] Added installer, setup.exe. 50 | 51 | ### Changed 52 | 53 | - New layout for required software page. 54 | 55 | ## [0.2.0] - 2023-01-04 56 | 57 | ### Added 58 | 59 | - Add dark mode. 60 | - Add new layouts for wide window size. 61 | - Add menu to move project to the Recycle Bin or Trash. 62 | 63 | ### Changed 64 | 65 | - Change internal state management to improve app responses. 66 | 67 | ### Fixed 68 | 69 | - Fix app couldn't add StarterVPM project. 70 | - Fix app couldn't start when settings.json of VCC is missng. 71 | - [macOS] Fix backup folder select dialog not opended. 72 | 73 | ## [0.1.0] - 2022-12-31 74 | 75 | ### Added 76 | 77 | - Add button to open settings folder in settings page. 78 | - Add requirements page to show required software. 79 | - Add logging feature. Logs are written to following folders. 80 | - Windows: `%USERPROFILE%\AppData\Loaming\kurotu\Tiny VCC\logs` 81 | - macOS: `~/Library/Application Support/com.github.kurotu.tiny-vcc/logs` 82 | - Add button to detect installed Unity Editors. 83 | 84 | ### Changed 85 | 86 | - Reduce times to execute Unity Hub for requirements check. 87 | 88 | ### Fixed 89 | 90 | - Fix app crashed when adding AvatarGit or WorldGit project. 91 | - Fix a case where app may crash even when .NET and VPM CLI are installed. 92 | - Fix last project location not saved when creating a new project. 93 | 94 | ## [0.0.2] - 2022-12-22 95 | 96 | ### Fixed 97 | 98 | - [macOS] Fix installed Unity editors not properly detected. 99 | - Fix text fields of new project screen not properly working. 100 | - Fix update checker not properly initialized. 101 | 102 | ## [0.0.1] - 2022-12-21 103 | 104 | - Initial release. 105 | -------------------------------------------------------------------------------- /CHANGELOG_JP.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 | 8 | ## [0.6.1] - 2023-12-06 9 | 10 | ### 修正 11 | - パッケージリストが正しく表示されないことがある問題を修正。 12 | - リポジトリが最新の情報に更新されない問題を修正。 13 | 14 | ## [0.6.0] - 2023-10-18 15 | 16 | ### 削除 17 | - VPM CLI のインストール時のバージョン固定をしないように変更。 18 | 19 | ### 修正 20 | 21 | - [macOS] Apple Silicon で Unity のインストールができない問題を修正。 22 | - [Windows] AMD CPU の Windows 11 でアーキテクチャの検出ができない問題を修正。 23 | - Unity のパスを手動選択しても正しく保存されない問題を修正。 24 | - Unity のバージョンチェックを修正。 25 | 26 | ## [0.5.0] - 2023-10-01 27 | 28 | ### 追加 29 | 30 | - 韓国語表示を追加。 (by [Kieaer](https://github.com/Kieaer)) 31 | 32 | ## [0.4.0] - 2023-03-21 33 | 34 | ### 追加 35 | 36 | - ダークテーマを追加。 37 | - 日本語表示を追加。 38 | - 簡体字中国語表示を追加。 (by [Sonic853](https://github.com/Sonic853)) 39 | 40 | ### 変更 41 | 42 | - メインページを新しいレイアウトに変更。 43 | 44 | ## [0.3.0] - 2023-01-09 45 | 46 | ### 追加 47 | 48 | - 必須ソフトウェアのインストールを自動化 49 | - [Windows] インストーラー setup.exe を追加。 50 | 51 | ### 変更 52 | 53 | - 必須ソフトウェアページを新しいレイアウトに変更。 54 | 55 | ## [0.2.0] - 2023-01-04 56 | 57 | ### 追加 58 | 59 | - ダークモードを追加。 60 | - ウィンドウの幅が広い場合のレイアウトを追加。 61 | - プロジェクトをごみ箱に移動するメニューを追加。 62 | 63 | ### 変更 64 | 65 | - 内部の状態管理を変更し、アプリの応答を改善。 66 | 67 | ### 修正 68 | 69 | - StarterVPM プロジェクトを追加できない問題を修正。 70 | - VCC の settings.json がない場合に正常に起動しない問題を修正。 71 | - [macOS] バックアップフォルダの選択ダイアログが開かない問題を修正。 72 | 73 | ## [0.1.0] - 2022-12-31 74 | 75 | ### 追加 76 | 77 | - 設定画面に設定フォルダを開くボタンを追加。 78 | - 必要ソフトウェアを表示する画面を追加。 79 | - ログ機能を追加。ログは以下のフォルダに保存されます。 80 | - Windows: `%USERPROFILE%\AppData\Loaming\kurotu\Tiny VCC\logs` 81 | - macOS: `~/Library/Application Support/com.github.kurotu.tiny-vcc/logs` 82 | - インストールされた Unity を検出するボタンを追加。 83 | 84 | ### 変更 85 | 86 | - 必須ソフトウェアのチェックで Unity Hub を実行する回数を減少。 87 | 88 | ### 修正 89 | 90 | - AvatarGit または WorldGit プロジェクトを追加するとアプリがクラッシュする問題を修正。 91 | - .NET や VPM CLI がインストールされていてもアプリがクラッシュすることがある問題を修正。 92 | - プロジェクトを作成するとき最後のプロジェクト保存場所が保存されていない問題を修正。 93 | 94 | ## [0.0.2] - 2022-12-22 95 | 96 | ### 修正 97 | 98 | - [macOS] インストールされた Unity を正しく検出できない問題を修正。 99 | - 新しいプロジェクトを作成する画面でテキスト入力欄が正しく動作しない問題を修正。 100 | - 更新確認が正しく初期化されない問題を修正。 101 | 102 | ## [0.0.1] - 2022-12-21 103 | 104 | - 初版。 105 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > [!CAUTION] 2 | > Archived repository. This project is no longer maintained. 3 | > Consider using [vrc-get-gui](https://github.com/vrc-get/vrc-get) as an alternative. 4 | 5 | # Tiny VCC 6 |

7 | 8 | Release 9 | 10 |

11 | 12 | Yet Another VRChat Creator Companion for macOS and Windows. 13 | 14 | [ [Download](https://github.com/kurotu/tiny_vcc/releases/latest) ] 15 | 16 | [ English | [日本語](./README_JP.md) ] 17 | 18 | ## Introduction 19 | Tiny VCC is a VCC alternative application for macOS and Windows. 20 | It behaves as a GUI wrapper of VPM CLI and provides these core features of VCC. 21 | 22 | - Project and package management 23 | - Project migration from legacy project 24 | - Back Up Your Projects 25 | 26 | ## Installation 27 | 28 | Other required software will be installed by the app. 29 | 30 | ### Windows 31 | 1. Download `tiny_vcc-vX.X.X.zip` from [the latest release](https://github.com/kurotu/tiny_vcc/releases/latest), then extract it to a desired location. 32 | 2. Execute `setup.exe` in the extracted folder. 33 | 34 | ### macOS 35 | 1. Download `TinyVCC-vX.X.X.dmg` from [the latest release](https://github.com/kurotu/tiny_vcc/releases/latest), then open it. 36 | 2. Drag & drop `Tiny VCC` into `Applications` folder. 37 | 3. Open `Applications` folder, then select *Open* from right-click menu of `Tiny VCC`. 38 | 39 | ## Verified Environments 40 | - Windows 10 21H2 41 | - macOS Big Sur 11.7.2 (Intel) 42 | - VPM CLI 0.1.13 43 | 44 | ## License 45 | Licensed under the [GPLv3](./LICENSE). 46 | 47 | ## Cantacts and Feedback 48 | - VRCID: kurotu 49 | - Twitter: [@kurotu](https://twitter.com/kurotu) 50 | - GitHub: [kurotu/tiny_vcc](https://github.com/kurotu/tiny_vcc) 51 | -------------------------------------------------------------------------------- /README_JP.md: -------------------------------------------------------------------------------- 1 | > [!CAUTION] 2 | > アーカイブされたリポジトリです。このプロジェクトはメンテナンスされていません。 3 | > 代替として [vrc-get-gui](https://github.com/vrc-get/vrc-get) を検討してください。 4 | 5 | # Tiny VCC 6 |

7 | 8 | Release 9 | 10 |

11 | 12 | Yet Another VRChat Creator Companion for macOS and Windows. 13 | 14 | [ [ダウンロード](https://github.com/kurotu/tiny_vcc/releases/latest) ] 15 | 16 | [ [English](./README.md) | 日本語 ] 17 | 18 | ## 概要 19 | 20 | macOS/Windows で使用可能な VCC の代替アプリケーションです。 21 | VPM CLI の GUI ラッパーとして動作し、 VCC のコア機能のうち以下の機能を提供します。 22 | 23 | - プロジェクトとパッケージの管理 24 | - レガシープロジェクトから VCC 対応プロジェクトへの移行 25 | - プロジェクトのバックアップ 26 | 27 | ## インストール 28 | 29 | 他の必須ソフトウェアはアプリによってインストールされます。 30 | 31 | ### Windows 32 | 1. [最新のリリース](https://github.com/kurotu/tiny_vcc/releases/latest) から `tiny_vcc-vX.X.X.zip` をダウンロードし、任意の場所に展開します。 33 | 2. 展開したフォルダの中にある `setup.exe` を実行します。 34 | 35 | ### macOS 36 | 1. [最新のリリース](https://github.com/kurotu/tiny_vcc/releases/latest) から `TinyVCC-vX.X.X.dmg` をダウンロードし、開きます。 37 | 2. 表示されたウィンドウにある `Tiny VCC` を `Applications` フォルダにドラッグ&ドロップします。 38 | 3. `Applications` フォルダを開き、 `Tiny VCC` を右クリックして「開く」を選択します。 39 | 40 | ## 動作確認済み環境 41 | - Windows 10 21H2 42 | - macOS Big Sur 11.7.2 (Intel) 43 | - VPM CLI 0.1.13 44 | 45 | ## ライセンス 46 | [GPLv3](./LICENSE) で提供されます。 47 | 48 | ## 連絡先・フィードバック 49 | - VRCID: kurotu 50 | - Twitter: [@kurotu](https://twitter.com/kurotu) 51 | - GitHub: [kurotu/tiny_vcc](https://github.com/kurotu/tiny_vcc) 52 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion flutter.compileSdkVersion 30 | ndkVersion flutter.ndkVersion 31 | 32 | compileOptions { 33 | sourceCompatibility JavaVersion.VERSION_1_8 34 | targetCompatibility JavaVersion.VERSION_1_8 35 | } 36 | 37 | kotlinOptions { 38 | jvmTarget = '1.8' 39 | } 40 | 41 | sourceSets { 42 | main.java.srcDirs += 'src/main/kotlin' 43 | } 44 | 45 | defaultConfig { 46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 47 | applicationId "com.example.tiny_vcc" 48 | // You can update the following values to match your application needs. 49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. 50 | minSdkVersion flutter.minSdkVersion 51 | targetSdkVersion flutter.targetSdkVersion 52 | versionCode flutterVersionCode.toInteger() 53 | versionName flutterVersionName 54 | } 55 | 56 | buildTypes { 57 | release { 58 | // TODO: Add your own signing config for the release build. 59 | // Signing with the debug keys for now, so `flutter run --release` works. 60 | signingConfig signingConfigs.debug 61 | } 62 | } 63 | } 64 | 65 | flutter { 66 | source '../..' 67 | } 68 | 69 | dependencies { 70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 71 | } 72 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/tiny_vcc/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.tiny_vcc 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.6.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.1.2' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip 6 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /assets/images/app_icon-1024x1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/assets/images/app_icon-1024x1024.png -------------------------------------------------------------------------------- /assets/images/app_icon_mac-1024x1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/assets/images/app_icon_mac-1024x1024.png -------------------------------------------------------------------------------- /assets/texts/LICENSE_NOTICE: -------------------------------------------------------------------------------- 1 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 2 | 3 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 4 | 5 | You should have received a copy of the GNU General Public License along with this program. If not, see . -------------------------------------------------------------------------------- /installer/TinyVccInstaller/TinyVccInstaller.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.4.33110.190 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "TinyVccInstaller", "TinyVccInstaller\TinyVccInstaller.vdproj", "{035261A3-215D-41C1-9621-D5DB4AF553E0}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Default = Debug|Default 11 | Release|Default = Release|Default 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {035261A3-215D-41C1-9621-D5DB4AF553E0}.Debug|Default.ActiveCfg = Debug 15 | {035261A3-215D-41C1-9621-D5DB4AF553E0}.Debug|Default.Build.0 = Debug 16 | {035261A3-215D-41C1-9621-D5DB4AF553E0}.Release|Default.ActiveCfg = Release 17 | {035261A3-215D-41C1-9621-D5DB4AF553E0}.Release|Default.Build.0 = Release 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {37D7FE3D-D9B0-4BD1-A0A9-4CAA4643C5D9} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /installer/TinyVccInstaller/TinyVccInstaller/files.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/installer/TinyVccInstaller/TinyVccInstaller/files.txt -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 11.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '11.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Tiny Vcc 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | tiny_vcc 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | CADisableMinimumFrameDurationOnPhone 47 | 48 | UIApplicationSupportsIndirectInputEvents 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /lib/caches/simple_cache.dart: -------------------------------------------------------------------------------- 1 | class SimpleCache { 2 | T? _data; 3 | 4 | bool get hasCache => _data != null; 5 | 6 | T get() { 7 | return _data!; 8 | } 9 | 10 | void set(T data) { 11 | _data = data; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /lib/data/exceptions.dart: -------------------------------------------------------------------------------- 1 | import '../services/vcc_service.dart'; 2 | 3 | class NonZeroExitException implements Exception { 4 | NonZeroExitException(this.executable, this.arguments, this.exitCode); 5 | 6 | final String executable; 7 | final List arguments; 8 | final int exitCode; 9 | 10 | @override 11 | String toString() { 12 | final argStr = 13 | arguments.map((arg) => arg.contains(' ') ? '"$arg"' : arg).join(' '); 14 | final exeStr = executable.contains(' ') ? '"$executable"' : executable; 15 | final command = argStr == '' ? exeStr : '$exeStr $argStr'; 16 | return 'NonZeroExitException: $command returned non-zero exit code $exitCode.'; 17 | } 18 | } 19 | 20 | class VccProjectTypeException implements Exception { 21 | VccProjectTypeException(message, this.projectType) : _message = message; 22 | 23 | final String _message; 24 | final VccProjectType projectType; 25 | 26 | @override 27 | String toString() { 28 | return 'VccProjectTypeException: $_message'; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/data/tiny_vcc_data.dart: -------------------------------------------------------------------------------- 1 | enum TinyVccThemeMode { 2 | system, 3 | light, 4 | dark, 5 | } 6 | 7 | enum RequirementState { ok, ng, notChecked } 8 | 9 | class TinyVccSettings { 10 | TinyVccSettings({ 11 | required this.themeMode, 12 | required this.locale, 13 | }); 14 | 15 | TinyVccSettings.defaultValues() 16 | : themeMode = TinyVccThemeMode.system, 17 | locale = 'auto'; 18 | 19 | final TinyVccThemeMode themeMode; 20 | final String locale; 21 | } 22 | -------------------------------------------------------------------------------- /lib/data/vcc_data.dart: -------------------------------------------------------------------------------- 1 | /// VCC settings.json 2 | class VccSettings { 3 | VccSettings({ 4 | required this.pathToUnityExe, 5 | required this.pathToUnityHub, 6 | required this.projectBackupPath, 7 | required this.userProjects, 8 | required this.unityEditors, 9 | required this.defaultProjectPath, 10 | required this.userPackageFolders, 11 | required this.showPrereleasePackages, 12 | required this.userRepos, 13 | }); 14 | 15 | final String pathToUnityExe; 16 | final String pathToUnityHub; 17 | final String projectBackupPath; 18 | final List userProjects; 19 | final List unityEditors; 20 | final String defaultProjectPath; 21 | final List userPackageFolders; 22 | final bool showPrereleasePackages; 23 | final List userRepos; 24 | 25 | VccSettings copyWith({ 26 | String? pathToUnityExe, 27 | String? pathToUnityHub, 28 | String? projectBackupPath, 29 | List? userProjects, 30 | List? unityEditors, 31 | String? defaultProjectPath, 32 | List? userPackageFolders, 33 | bool? showPrereleasePackages, 34 | List? userRepos, 35 | }) { 36 | return VccSettings( 37 | pathToUnityExe: pathToUnityExe ?? this.pathToUnityExe, 38 | pathToUnityHub: pathToUnityHub ?? this.pathToUnityHub, 39 | projectBackupPath: projectBackupPath ?? this.projectBackupPath, 40 | userProjects: userProjects ?? [...this.userProjects], 41 | unityEditors: unityEditors ?? [...this.unityEditors], 42 | defaultProjectPath: defaultProjectPath ?? this.defaultProjectPath, 43 | userPackageFolders: userPackageFolders ?? [...this.userPackageFolders], 44 | showPrereleasePackages: 45 | showPrereleasePackages ?? this.showPrereleasePackages, 46 | userRepos: userRepos ?? [...this.userRepos], 47 | ); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/globals.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:logger/logger.dart'; 3 | import 'package:pub_semver/pub_semver.dart'; 4 | 5 | final RouteObserver> routeObserver = 6 | RouteObserver>(); 7 | final scaffoldKey = GlobalKey(); 8 | const vpmPackageId = 'vrchat.vpm.cli'; 9 | final requiredVpmVersion = Version(0, 1, 13); 10 | const requiredUnityVersion = '2019.4.31f1'; 11 | const requiredUnityChangeset = 'bd5abf232a62'; 12 | 13 | /// Logger to output logs. 14 | Logger? logger; 15 | -------------------------------------------------------------------------------- /lib/i18n/strings_zh-CN.i18n.json: -------------------------------------------------------------------------------- 1 | { 2 | "lang_name": "简体中文", 3 | "common": { 4 | "labels": { 5 | "yes": "是", 6 | "no": "否", 7 | "ok": "确定", 8 | "cancel": "取消", 9 | "dismiss": "关闭" 10 | } 11 | }, 12 | "navigation": { 13 | "new_project": "新建项目", 14 | "projects": "项目", 15 | "settings": "设置", 16 | "about": "关于 Tiny VCC" 17 | }, 18 | "actions": { 19 | "add_project": { 20 | "tooltip": "添加现有项目" 21 | }, 22 | "create_project": { 23 | "tooltip": "创建新项目" 24 | }, 25 | "open_vcc_settings_folder": { 26 | "label": "打开 VCC 设置文件夹" 27 | }, 28 | "open_logs_folder": { 29 | "label": "打开日志文件夹" 30 | } 31 | }, 32 | "projects": { 33 | "labels": { 34 | "open_folder": "打开文件夹", 35 | "remove_from_list": "从列表中移除", 36 | "move_to_recycle_bin": "移动到回收站", 37 | "move_to_trash": "移动到废纸篓" 38 | }, 39 | "dialogs": { 40 | "remove_project": { 41 | "title": "移除 $projectName", 42 | "content_win": "你确定要将 $projectPath 移动到回收站吗?", 43 | "content_others": "你确定要将 $projectPath 移动到废纸篓吗?" 44 | } 45 | }, 46 | "info": { 47 | "failed_to_remove": "无法移除 $projectPath。", 48 | "error_project_not_supported": "项目 \"$path\" 不受支持。", 49 | "error_add_project": "添加项目时发生错误。", 50 | "error_project_not_exist": "$projectPath 不存在。", 51 | "avatar_git_not_supported": "Avatar Git 项目 ($projectPath) 不受 Tiny VCC 支持。", 52 | "world_git_not_supported": "World Git 项目 ($projectPath) 不受 Tiny VCC 支持。", 53 | "project_is_sdk2": "$projectPath 是 VRCSDK2 项目。", 54 | "project_is_invalid": "$projectPath 是无效项目。" 55 | } 56 | }, 57 | "settings": { 58 | "headers": { 59 | "tiny_vcc_preferences": "Tiny VCC 首选项", 60 | "vcc_settings": "VCC 设置" 61 | }, 62 | "labels": { 63 | "theme": "主题", 64 | "language": "语言", 65 | "unity_editors": "Unity 编辑器", 66 | "backups": "备份", 67 | "user_packages": "用户包" 68 | }, 69 | "theme": { 70 | "auto": "自动", 71 | "light": "浅色", 72 | "dark": "深色" 73 | }, 74 | "lang": { 75 | "auto": "自动" 76 | } 77 | }, 78 | "new_project": { 79 | "title": "新项目", 80 | "labels": { 81 | "project_template": "项目模板", 82 | "project_name": "项目名称", 83 | "location": "位置", 84 | "create": "创建" 85 | }, 86 | "errors": { 87 | "select_project_template": "请选择项目模板。", 88 | "enter_project_name": "请输入项目名称。", 89 | "enter_location_path": "请输入位置路径。", 90 | "failed_to_create_project": "创建项目失败。" 91 | }, 92 | "info": { 93 | "creating_project": "正在 $location 此路径创建 $template 项目 \"$name\"。", 94 | "created_project": "$template 项目 \"$name\" 已在 $projectLocation 路径创建。" 95 | } 96 | }, 97 | "project": { 98 | "labels": { 99 | "open_project": "打开项目", 100 | "open_folder": "打开文件夹", 101 | "make_backup": "创建备份", 102 | "add": "添加", 103 | "update": "更新", 104 | "downgrade": "降级", 105 | "remove": "移除" 106 | }, 107 | "info": { 108 | "packages_changed": "包已更改。关闭并重新打开 Unity 项目以应用更改。", 109 | "unity_not_found": "VCC 设置中未找到 Unity $editorVersion。" 110 | }, 111 | "dialogs": { 112 | "progress_backup": { 113 | "title": "正在备份 $name" 114 | }, 115 | "made_backup": { 116 | "title": "已创建备份", 117 | "labels": { 118 | "show_me": "显示" 119 | } 120 | }, 121 | "backup_error": { 122 | "title": "备份错误", 123 | "content": "无法备份 $projectName。\n\n$error" 124 | } 125 | } 126 | }, 127 | "legacy_project": { 128 | "labels": { 129 | "migrate": "迁移", 130 | "open_folder": "打开文件夹", 131 | "make_backup": "创建备份" 132 | }, 133 | "dialogs": { 134 | "confirm": { 135 | "title": "项目迁移", 136 | "content": "需要迁移。", 137 | "labels": { 138 | "migrate_a_copy": "迁移副本", 139 | "migrate_in_place": "迁移\n我已备份" 140 | } 141 | }, 142 | "progress_backup": { 143 | "title": "正在备份 $name" 144 | }, 145 | "made_backup": { 146 | "title": "已创建备份", 147 | "labels": { 148 | "show_me": "显示" 149 | } 150 | }, 151 | "backup_error": { 152 | "title": "备份错误", 153 | "content": "无法备份 $projectName。\n\n$error" 154 | }, 155 | "progress_migration": { 156 | "title": "正在迁移 $name" 157 | } 158 | } 159 | }, 160 | "requirements": { 161 | "title": "要求", 162 | "labels": { 163 | "dotnet6sdk": ".NET 6.0 SDK", 164 | "vpm_cli": "VPM CLI", 165 | "unity_hub": "Unity Hub", 166 | "unity": "Unity", 167 | "install": "安装", 168 | "check_again": "再次检查" 169 | }, 170 | "info": { 171 | "downloading_dotnet": "正在下载 .NET 6.0 SDK 安装程序。", 172 | "installing_dotnet": "正在安装 .NET 6.0 SDK。", 173 | "installing_dotnet_with_brew": "正在使用 Homebrew 安装 .NET 6.0 SDK", 174 | "see_terminal_to_continue": "请查看终端应用程序以继续安装。", 175 | "installing_vpm": "正在安装 VPM CLI", 176 | "downloading_unity_hub": "正在下载 Unity Hub 安装程序。", 177 | "installing_unity_hub": "正在安装 Unity Hub。", 178 | "installing_unity": "正在安装 Unity" 179 | }, 180 | "description": { 181 | "dotnet": "安装 .NET 6.0 SDK。您也可以从网页下载 SDK 安装程序。", 182 | "dotnet_brew": "使用 Homebrew 安装 .NET 6.0 SDK。您也可以使用以下命令安装。", 183 | "dotnet_linux": "使用包管理器安装 .NET 6.0 SDK。请参阅以下说明。", 184 | "vpm": "安装 VPM CLI。您也可以使用以下命令安装。", 185 | "unity_hub": "安装 Unity Hub。您也可以从网页下载安装程序。", 186 | "unity_hub_linux": "安装 Unity Hub。请参阅以下说明。", 187 | "unity": "使用 Unity Hub 安装 Unity。您也可以从归档文件安装,但应安装 VRChat 指定的确切版本。", 188 | "unity_modules": "在手动安装中,您必须一起安装以下模块:", 189 | "unity_modules_android": "Android Build Support(用来上传到 Quest)", 190 | "unity_modules_mono": "Windows Build Support (mono)(用来从 macOS 或 Linux 上传到 PC)" 191 | }, 192 | "errors": { 193 | "failed_to_isntall_dotnet": ".NET SDK 安装失败", 194 | "failed_to_isntall_vpm": "VPM CLI 安装失败", 195 | "failed_to_isntall_unity_hub": "Unity Hub 安装失败", 196 | "failed_to_isntall_unity": "Unity 安装失败" 197 | } 198 | } 199 | } -------------------------------------------------------------------------------- /lib/main_drawer.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | 4 | import 'providers.dart'; 5 | 6 | class MainDrawer extends ConsumerWidget { 7 | const MainDrawer( 8 | {super.key, required this.selectedIndex, required this.onItemSelected}); 9 | 10 | final int selectedIndex; 11 | final Function(int selectedIndex) onItemSelected; 12 | 13 | void _didSelectItem(BuildContext context, int index) { 14 | Navigator.pop(context); 15 | onItemSelected(index); 16 | } 17 | 18 | @override 19 | Widget build(BuildContext context, WidgetRef ref) { 20 | final t = ref.watch(translationProvider); 21 | return Drawer( 22 | child: ListView( 23 | children: [ 24 | _DrawerListTile( 25 | index: 0, 26 | selectedIndex: selectedIndex, 27 | selectedLeading: const Icon(Icons.folder_special), 28 | leading: const Icon(Icons.folder_special_outlined), 29 | title: Text(t.navigation.projects), 30 | onSelect: (value) { 31 | _didSelectItem(context, value); 32 | }, 33 | ), 34 | _DrawerListTile( 35 | index: 1, 36 | selectedIndex: selectedIndex, 37 | selectedLeading: const Icon(Icons.settings), 38 | leading: const Icon(Icons.settings_outlined), 39 | title: Text(t.navigation.settings), 40 | onSelect: (value) { 41 | _didSelectItem(context, value); 42 | }, 43 | ), 44 | const Divider(), 45 | _AboutListTile(), 46 | ], 47 | ), 48 | ); 49 | } 50 | } 51 | 52 | class _DrawerListTile extends StatelessWidget { 53 | const _DrawerListTile( 54 | {required this.index, 55 | required this.selectedIndex, 56 | required this.selectedLeading, 57 | required this.leading, 58 | required this.title, 59 | required this.onSelect}); 60 | 61 | final int index; 62 | final int selectedIndex; 63 | final Widget selectedLeading; 64 | final Widget leading; 65 | final Widget title; 66 | 67 | final Function(int index) onSelect; 68 | 69 | @override 70 | Widget build(BuildContext context) { 71 | bool selected = selectedIndex == index; 72 | return ListTile( 73 | title: title, 74 | leading: selected ? selectedLeading : leading, 75 | selected: selected, 76 | onTap: () { 77 | onSelect(index); 78 | }, 79 | ); 80 | } 81 | } 82 | 83 | class _AboutListTile extends ConsumerWidget { 84 | @override 85 | Widget build(BuildContext context, WidgetRef ref) { 86 | final info = ref.watch(packageInfoProvider); 87 | final notice = ref.watch(licenseNoticeProvider); 88 | return AboutListTile( 89 | icon: const Icon(Icons.info_outline), 90 | applicationVersion: info.value?.version, 91 | applicationIcon: Image.asset( 92 | 'assets/images/app_icon-1024x1024.png', 93 | width: 64, 94 | height: 64, 95 | ), 96 | applicationLegalese: notice.value, 97 | ); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /lib/repos/requirements_repository.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:pub_semver/pub_semver.dart'; 4 | 5 | import '../services/dotnet_service.dart'; 6 | import '../services/vcc_service.dart'; 7 | 8 | class RequirementsRepository { 9 | RequirementsRepository(DotNetService dotnet, VccService vcc) 10 | : _dotnet = dotnet, 11 | _vcc = vcc; 12 | 13 | final DotNetService _dotnet; 14 | final VccService _vcc; 15 | 16 | Future checkDotNetCommand() async { 17 | return _dotnet.isInstalled(); 18 | } 19 | 20 | Future checkDotNet6Sdk() async { 21 | final sdks = await _dotnet.listSdks(); 22 | const missingVersion = 'MISSING'; 23 | final sdk6Version = sdks.keys 24 | .firstWhere((v) => v.startsWith('6.'), orElse: () => missingVersion); 25 | if (sdk6Version == missingVersion) { 26 | return false; 27 | } 28 | return true; 29 | } 30 | 31 | Future checkVpmCommand() async { 32 | return _vcc.isInstalled(); 33 | } 34 | 35 | Future checkVpmVersion(Version requiredVersion) async { 36 | try { 37 | final version = await _vcc.getCliVersion(); 38 | if (version < requiredVersion) { 39 | false; 40 | } 41 | return true; 42 | } on ProcessException { 43 | return false; 44 | } 45 | } 46 | 47 | Future checkUnityHub() async { 48 | return _vcc.checkHub(); 49 | } 50 | 51 | Future checkUnity() async { 52 | return _vcc.checkUnity(); 53 | } 54 | 55 | Future installVpmCli(Version version) async { 56 | await _dotnet.installGlobalTool('vrchat.vpm.cli', version.toString()); 57 | if (!_vcc.isInstalled()) { 58 | throw Exception('Installed vpm not detected.'); 59 | } 60 | await _vcc.installTemplates(); 61 | await _vcc.listRepos(); 62 | } 63 | 64 | Future updateVpmCli(Version version) async { 65 | await _dotnet.updateGlobalTool('vrchat.vpm.cli', version.toString()); 66 | await _vcc.installTemplates(); 67 | await _vcc.listRepos(); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /lib/repos/tiny_vcc_settings_repository.dart: -------------------------------------------------------------------------------- 1 | import '../data/tiny_vcc_data.dart'; 2 | import '../services/tiny_vcc_service.dart'; 3 | 4 | class TinyVccSettingsRepository { 5 | TinyVccSettingsRepository(TinyVccService tinyVcc) : _tinyVcc = tinyVcc; 6 | final TinyVccService _tinyVcc; 7 | 8 | Future fetchSettings() async { 9 | return _tinyVcc.loadSettings(); 10 | } 11 | 12 | Future setThemeMode(TinyVccThemeMode mode) async { 13 | await _tinyVcc.writeSettings(themeMode: mode); 14 | } 15 | 16 | Future setLocale(String locale) async { 17 | await _tinyVcc.writeSettings(locale: locale); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /lib/repos/vcc_projects_repository.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io'; 3 | 4 | import '../services/vcc_service.dart'; 5 | 6 | class VccProjectsRepository { 7 | VccProjectsRepository(VccService vcc) : _vcc = vcc; 8 | 9 | final VccService _vcc; 10 | 11 | List? _projects; 12 | 13 | Future> fetchVccProjects() async { 14 | final setting = await _vcc.getSettings(); 15 | _projects = setting.userProjects.map((e) => VccProject(e)).toList(); 16 | _sortProjects(); 17 | return _projects!; 18 | } 19 | 20 | Future createVccProject( 21 | VpmTemplate template, String name, String location) async { 22 | final project = await _vcc.createNewProject(template, name, location); 23 | await fetchVccProjects(); 24 | return project; 25 | } 26 | 27 | Future addVccProject(VccProject project) async { 28 | await _vcc.addUserProject(Directory(project.path)); 29 | await fetchVccProjects(); 30 | } 31 | 32 | Future deleteVccProject(VccProject project) async { 33 | await _vcc.deleteUserProject(project); 34 | await fetchVccProjects(); 35 | } 36 | 37 | Future checkProjectType(VccProject project) { 38 | return _vcc.checkUserProject(project); 39 | } 40 | 41 | Future migrateCopy(VccProject project) { 42 | return _vcc.migrateProject(project, false); 43 | } 44 | 45 | Future migrateInPlace(VccProject project) { 46 | return _vcc.migrateProject(project, true); 47 | } 48 | 49 | Future backup(VccProject project) async { 50 | return _vcc.backupProject(project); 51 | } 52 | 53 | void _sortProjects() { 54 | _projects?.sort(((a, b) => a.name.compareTo(b.name))); 55 | } 56 | 57 | Future migrateProjectWithStream( 58 | VccProject project, 59 | bool inPlace, { 60 | required Null Function(dynamic text) onStdout, 61 | required Null Function(dynamic text) onStderr, 62 | }) async { 63 | return _vcc.migrateProjectWithStream( 64 | project, 65 | inPlace, 66 | onStdout: onStdout, 67 | onStderr: onStderr, 68 | ); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /lib/repos/vcc_settings_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:pub_semver/pub_semver.dart'; 2 | 3 | import '../caches/simple_cache.dart'; 4 | import '../data/vcc_data.dart'; 5 | import '../services/vcc_service.dart'; 6 | 7 | class VccSettingsRepository { 8 | VccSettingsRepository(VccService vcc) : _vcc = vcc; 9 | 10 | final VccService _vcc; 11 | 12 | final _settingsCache = SimpleCache(); 13 | 14 | Future fetchCliVersion() async { 15 | return _vcc.getCliVersion(); 16 | } 17 | 18 | Future fetchSettings({bool refresh = false}) async { 19 | if (_settingsCache.hasCache && !refresh) { 20 | return _settingsCache.get(); 21 | } 22 | final setting = await _vcc.getSettings(); 23 | _settingsCache.set(setting); 24 | return setting; 25 | } 26 | 27 | Future setPreferredEditor(String path) async { 28 | await _vcc.addUnityEditor(path); 29 | return _setSettings(pathToUnityExe: path); 30 | } 31 | 32 | Future setBackupFolder(String path) async { 33 | return _setSettings(projectBackupPath: path); 34 | } 35 | 36 | Future addUnityEditor(String path) async { 37 | await _vcc.addUnityEditor(path); 38 | await fetchSettings(refresh: true); 39 | } 40 | 41 | Future setUnityEditors(List paths) async { 42 | await _vcc.setUnityEditors(paths); 43 | await fetchSettings(refresh: true); 44 | } 45 | 46 | Future getUnityEditor(String version) async { 47 | final settings = await fetchSettings(); 48 | final editor = settings.unityEditors.firstWhere( 49 | (editorPath) => editorPath.contains(version), 50 | orElse: () => '', 51 | ); 52 | if (editor == '') { 53 | return null; 54 | } 55 | return editor; 56 | } 57 | 58 | Future setDefaultProjectPath(String path) async { 59 | await _vcc.setSettings(defaultProjectPath: path); 60 | await fetchSettings(refresh: true); 61 | } 62 | 63 | Future addUserPackageFolder(String path) async { 64 | final settings = await fetchSettings(refresh: false); 65 | if (settings.userPackageFolders.contains(path)) { 66 | return; 67 | } 68 | await _vcc.addUserPackageFolder(path); 69 | await fetchSettings(refresh: true); 70 | } 71 | 72 | Future deleteUserPackageFolder(String path) async { 73 | await _vcc.deleteUserPackageFolder(path); 74 | await fetchSettings(refresh: true); 75 | } 76 | 77 | Future _setSettings({ 78 | String? pathToUnityExe, 79 | String? projectBackupPath, 80 | }) async { 81 | await _vcc.setSettings( 82 | pathToUnityExe: pathToUnityExe, 83 | projectBackupPath: projectBackupPath, 84 | ); 85 | await fetchSettings(refresh: true); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /lib/repos/vcc_templates_repository.dart: -------------------------------------------------------------------------------- 1 | import '../services/vcc_service.dart'; 2 | 3 | class VccTemplatesRepository { 4 | VccTemplatesRepository(VccService vcc) : _vcc = vcc; 5 | 6 | final VccService _vcc; 7 | 8 | Future> fetchTemplates() async { 9 | final templates = await _vcc.getTemplates(); 10 | templates.removeWhere((element) => element.name == 'Base'); 11 | return templates; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /lib/repos/vpm_packages_repository.dart: -------------------------------------------------------------------------------- 1 | import 'package:pub_semver/pub_semver.dart'; 2 | 3 | import '../services/vcc_service.dart'; 4 | 5 | class VpmPackagesRepository { 6 | VpmPackagesRepository(VccService vcc) : _vcc = vcc; 7 | 8 | final VccService _vcc; 9 | 10 | List? _packages; 11 | List? get packages => _packages; 12 | 13 | Future> fetchPackages({bool refresh = false}) async { 14 | if (_packages == null || refresh) { 15 | _packages = await _vcc.getVpmPackages(); 16 | } 17 | return _packages!; 18 | } 19 | 20 | List getVersions( 21 | String name, Version? installedVersion, bool showPrerelease) { 22 | final list = _packages!.where((element) => element.name == name).toList(); 23 | if (!showPrerelease) { 24 | list.removeWhere((element) => 25 | element.version.isPreRelease && element.version != installedVersion); 26 | } 27 | list.sort(((a, b) => b.version.compareTo(a.version))); 28 | return list; 29 | } 30 | 31 | VpmPackage? getLatest( 32 | String name, Version? installedVersion, bool showPrerelease) { 33 | final versions = getVersions(name, installedVersion, showPrerelease); 34 | if (versions.isEmpty) { 35 | return null; 36 | } 37 | return versions.first; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/services/dotnet_service.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io'; 3 | 4 | import 'package:http/http.dart' as http; 5 | 6 | import '../data/exceptions.dart'; 7 | import '../utils/system_info.dart'; 8 | 9 | class DotNetService { 10 | DotNetService() { 11 | _findDotNet(); 12 | } 13 | 14 | /// Use full path to avoid crash. 15 | /// https://stackoverflow.com/questions/69139808/ 16 | String _dotnetCommand = ''; 17 | 18 | static const _feed = 'https://dotnetcli.azureedge.net'; 19 | 20 | String? _findDotNet() { 21 | if (Platform.isWindows) { 22 | final result = Process.runSync('where', ['dotnet']); 23 | if (result.exitCode == 0) { 24 | _dotnetCommand = result.stdout.toString().trim(); 25 | return _dotnetCommand; 26 | } 27 | final defaultDotNet = File('C:\\Program Files\\dotnet\\dotnet.exe'); 28 | if (defaultDotNet.existsSync()) { 29 | _dotnetCommand = defaultDotNet.path; 30 | return _dotnetCommand; 31 | } 32 | _dotnetCommand = ''; 33 | return null; 34 | } 35 | if (Platform.isMacOS) { 36 | final result = Process.runSync('which', ['dotnet']); 37 | if (result.exitCode == 0) { 38 | _dotnetCommand = result.stdout.toString().trim(); 39 | return _dotnetCommand; 40 | } 41 | const defaultDotNet = '/usr/local/share/dotnet/dotnet'; 42 | if (File(defaultDotNet).existsSync()) { 43 | _dotnetCommand = defaultDotNet; 44 | return defaultDotNet; 45 | } 46 | const brewDotNet6 = '/usr/local/opt/dotnet@6/bin/dotnet'; 47 | if (File(brewDotNet6).existsSync()) { 48 | _dotnetCommand = brewDotNet6; 49 | return brewDotNet6; 50 | } 51 | _dotnetCommand = ''; 52 | return null; 53 | } 54 | final result = Process.runSync('which', ['dotnet']); 55 | if (result.exitCode == 0) { 56 | _dotnetCommand = result.stdout.toString().trim(); 57 | return _dotnetCommand; 58 | } 59 | _dotnetCommand = ''; 60 | return null; 61 | } 62 | 63 | Future isInstalled() async { 64 | final dotnet = _findDotNet(); 65 | _dotnetCommand = dotnet ?? 'dotnet'; 66 | return dotnet != null; 67 | } 68 | 69 | Future getLatestVersion() async { 70 | final versionUri = Uri.parse('$_feed/dotnet/Sdk/6.0/latest.version'); 71 | return (await http.read(versionUri)).trim(); 72 | } 73 | 74 | Uri getWindowsInstallerUri(String version, Architecture arch) { 75 | return Uri.parse( 76 | '$_feed/dotnet/Sdk/$version/dotnet-sdk-$version-win-${arch.name}.exe'); 77 | } 78 | 79 | Uri getMacInstallerUri(String version, Architecture arch) { 80 | return Uri.parse( 81 | '$_feed/dotnet/Sdk/$version/dotnet-sdk-$version-osx-${arch.name}.pkg'); 82 | } 83 | 84 | Future> listSdks() async { 85 | final exe = _dotnetCommand; 86 | final args = ['--list-sdks']; 87 | final result = await Process.run(_dotnetCommand, args); 88 | if (result.exitCode != 0) { 89 | throw NonZeroExitException(exe, args, result.exitCode); 90 | } 91 | final lines = result.stdout.toString().split('\n').map((l) => l.trim()); 92 | final regex = RegExp(r'([^ ]*) \[(.*)\]'); 93 | final entries = lines.where((l) => regex.hasMatch(l)).map((l) { 94 | final match = regex.allMatches(l).toList(); 95 | final version = match[0][1]!; 96 | final path = match[0][2]!; 97 | return MapEntry(version, path); 98 | }); 99 | return Map.fromEntries(entries); 100 | } 101 | 102 | Future installGlobalTool(String packageId, String? version) async { 103 | final exe = _dotnetCommand; 104 | final args = ['tool', 'install', '--global', packageId]; 105 | if (version != null) { 106 | args.addAll(['--version', version]); 107 | } 108 | final result = await Process.run(exe, args); 109 | if (result.exitCode != 0) { 110 | throw NonZeroExitException(exe, args, result.exitCode); 111 | } 112 | } 113 | 114 | Future updateGlobalTool(String packageId, String? version) async { 115 | final exe = _dotnetCommand; 116 | final args = ['tool', 'update', '--global', packageId]; 117 | if (version != null) { 118 | args.addAll(['--version', version]); 119 | } 120 | final result = await Process.run(exe, args); 121 | if (result.exitCode != 0) { 122 | throw NonZeroExitException(exe, args, result.exitCode); 123 | } 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /lib/services/tiny_vcc_service.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:io'; 3 | 4 | import 'package:path/path.dart' as p; 5 | import 'package:path_provider/path_provider.dart'; 6 | 7 | import '../data/tiny_vcc_data.dart'; 8 | 9 | class TinyVccService { 10 | Future getSettingsDirectory() { 11 | return getApplicationSupportDirectory(); 12 | } 13 | 14 | Future getLogsDirectory() async { 15 | final settings = await getSettingsDirectory(); 16 | return Directory(p.join(settings.path, 'logs')); 17 | } 18 | 19 | Future loadSettings() async { 20 | final file = await _getSettingsFile(); 21 | if (!await file.exists()) { 22 | await file.writeAsString('{}'); 23 | final defaultValue = TinyVccSettings.defaultValues(); 24 | await writeSettings(themeMode: defaultValue.themeMode); 25 | } 26 | final str = await file.readAsString(); 27 | final json = jsonDecode(str); 28 | final def = TinyVccSettings.defaultValues(); 29 | return TinyVccSettings( 30 | themeMode: TinyVccThemeMode.values.byName(json['themeMode'] ?? 'system'), 31 | locale: json['locale'] ?? def.locale, 32 | ); 33 | } 34 | 35 | Future writeSettings({ 36 | TinyVccThemeMode? themeMode, 37 | String? locale, 38 | }) async { 39 | final file = await _getSettingsFile(); 40 | final str = await file.readAsString(); 41 | final json = jsonDecode(str); 42 | 43 | if (themeMode != null) { 44 | json['themeMode'] = themeMode.name; 45 | } 46 | if (locale != null) { 47 | json['locale'] = locale; 48 | } 49 | 50 | const encoder = JsonEncoder.withIndent(' '); 51 | final jsonStr = encoder.convert(json); 52 | await file.writeAsString((jsonStr), flush: true); 53 | } 54 | 55 | Future _getSettingsFile() async { 56 | final dir = await getSettingsDirectory(); 57 | return File(p.join(dir.path, 'settings.json')); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /lib/services/unity_hub_service.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:io'; 3 | 4 | import 'package:tuple/tuple.dart'; 5 | 6 | import '../data/exceptions.dart'; 7 | import '../utils/system_info.dart'; 8 | 9 | class UnityHubService { 10 | late String _unityHubExe; 11 | 12 | void setUnityHubExe(String unityHubExe) { 13 | _unityHubExe = unityHubExe; 14 | } 15 | 16 | Future> listInstalledEditors() async { 17 | final exe = _unityHubExe; 18 | final args = ['--', '--headless', 'editors', '-i']; 19 | if (Platform.isLinux) { 20 | args.removeAt(0); 21 | } 22 | final result = await Process.run(exe, args); 23 | if (result.exitCode != 0) { 24 | throw NonZeroExitException(exe, args, result.exitCode); 25 | } 26 | final lines = 27 | result.stdout.toString().split('\n').map((e) => e.trim()).toList(); 28 | final entries = UnityHubOutputParser.parseInstalledEditors(lines); 29 | return entries; 30 | } 31 | 32 | Future>> installUnity( 33 | String version, 34 | String changeset, 35 | Architecture arch, 36 | List? modules, 37 | ) async { 38 | final args = [ 39 | '--', 40 | '--headless', 41 | 'install', 42 | '--version', 43 | version, 44 | '-c', 45 | changeset, 46 | ]; 47 | 48 | // https://forum.unity.com/threads/install-apple-silicon-arm64-using-hub-cli.1423695/#post-9120544 49 | if (Platform.isMacOS && arch != Architecture.x64) { 50 | args.addAll(['--architecture', 'arm64']); 51 | } 52 | 53 | if (Platform.isLinux) { 54 | args.removeAt(0); 55 | } 56 | if (modules != null && modules.isNotEmpty) { 57 | args.add('--module'); 58 | args.addAll(modules); 59 | } 60 | 61 | final process = await Process.start(_unityHubExe, args); 62 | return Tuple2>(process, [_unityHubExe, ...args]); 63 | } 64 | 65 | Uri getWindowsInstallerUri() { 66 | return Uri.parse( 67 | 'https://public-cdn.cloud.unity3d.com/hub/prod/UnityHubSetup.exe'); 68 | } 69 | 70 | Uri getMacInstallerUri() { 71 | return Uri.parse( 72 | 'https://public-cdn.cloud.unity3d.com/hub/prod/UnityHubSetup.dmg'); 73 | } 74 | } 75 | 76 | class UnityHubOutputParser { 77 | /// Parses the output of `editors -i`. 78 | static Map parseInstalledEditors(List lines) { 79 | final regex = RegExp(r'^([^ ]*) .*, installed at (.*)$'); 80 | final entries = lines.where((l) => regex.hasMatch(l)).map((l) { 81 | final match = regex.allMatches(l).toList(); 82 | final version = match[0][1]!; 83 | final unityExe = match[0][2]!; 84 | return MapEntry(version, unityExe); 85 | }); 86 | return Map.fromEntries(entries); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /lib/services/updater_service.dart: -------------------------------------------------------------------------------- 1 | import 'package:github/github.dart'; 2 | 3 | class UpdaterService { 4 | UpdaterService(RepositorySlug repositorySlug) : _slug = repositorySlug; 5 | 6 | final _github = GitHub(); 7 | final RepositorySlug _slug; 8 | 9 | Future getLatestRelease() async { 10 | return _github.repositories.getLatestRelease(_slug); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /lib/utils.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:file_picker/file_picker.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:intl/intl.dart'; 6 | import 'package:logger/logger.dart'; 7 | import 'package:path/path.dart' as p; 8 | import 'package:sn_progress_dialog/sn_progress_dialog.dart'; 9 | 10 | import 'services/tiny_vcc_service.dart'; 11 | import 'utils/file_output.dart'; 12 | 13 | Future createLogger(bool isRelease) async { 14 | final dir = await TinyVccService().getLogsDirectory(); 15 | await dir.create(recursive: true); 16 | final logFileName = 17 | 'tiny-vcc_${DateFormat('yyyy-MM-dd_HH-mm-ss.SSS').format(DateTime.now())}.txt'; 18 | return isRelease 19 | ? createReleaseLogger(File(p.join(dir.path, logFileName))) 20 | : createDevelopLogger(); 21 | } 22 | 23 | Logger createDevelopLogger() { 24 | return Logger(); 25 | } 26 | 27 | Logger createReleaseLogger(File file) { 28 | return Logger( 29 | filter: ProductionFilter(), 30 | printer: SimplePrinter(colors: false, printTime: true), 31 | output: MultiOutput([ 32 | ConsoleOutput(), 33 | TinyVCCFileOutput(file: file, overrideExisting: true), 34 | ]), 35 | ); 36 | } 37 | 38 | Future showDirectoryPickerWindow({ 39 | required bool lockParentWindow, 40 | String? initialDirectory, 41 | }) async { 42 | final path = await FilePicker.platform.getDirectoryPath( 43 | lockParentWindow: lockParentWindow, 44 | // initialDirectory: initialDirectory, // on macOS, dialog isn't opened. 45 | ); 46 | return _cleanupPath(path); 47 | } 48 | 49 | Future showFilePickerWindow({ 50 | String? dialogTitle, 51 | required bool lockParentWindow, 52 | List? allowedExtensions, 53 | }) async { 54 | final result = await FilePicker.platform.pickFiles( 55 | dialogTitle: dialogTitle, 56 | type: allowedExtensions != null ? FileType.custom : FileType.any, 57 | allowMultiple: false, 58 | lockParentWindow: lockParentWindow, 59 | allowedExtensions: allowedExtensions, 60 | ); 61 | if (result == null) { 62 | return null; 63 | } 64 | return _cleanupPath(result.paths[0]); 65 | } 66 | 67 | String? _cleanupPath(String? path) { 68 | if (Platform.isMacOS) { 69 | path = path?.replaceFirst(RegExp('^/Volumes/Macintosh HD/'), '/'); 70 | } 71 | return path; 72 | } 73 | 74 | ScaffoldFeatureController showSnackBar( 75 | BuildContext context, String message) { 76 | return ScaffoldMessenger.of(context).showSnackBar(SnackBar( 77 | behavior: SnackBarBehavior.floating, 78 | width: 344, 79 | content: Text(message), 80 | )); 81 | } 82 | 83 | Future showAlertDialog(BuildContext context, 84 | {String? title, String? message}) { 85 | return showDialog( 86 | context: context, 87 | builder: ((context) => AlertDialog( 88 | title: title != null ? Text(title) : null, 89 | content: message != null ? Text(message) : null, 90 | actions: [ 91 | TextButton( 92 | onPressed: () { 93 | Navigator.pop(context); 94 | }, 95 | child: const Text('OK'), 96 | ), 97 | ], 98 | )), 99 | ); 100 | } 101 | 102 | Future showSimpleErrorDialog( 103 | BuildContext context, String message, Object error) { 104 | return showDialog( 105 | context: context, 106 | builder: ((context) => AlertDialog( 107 | title: const Text('Error'), 108 | content: Text('$message\n\n$error'), 109 | actions: [ 110 | TextButton( 111 | onPressed: () { 112 | Navigator.pop(context); 113 | }, 114 | child: const Text('OK'), 115 | ), 116 | ], 117 | )), 118 | ); 119 | } 120 | 121 | ProgressDialog showProgressDialog( 122 | BuildContext context, ThemeData theme, String message) { 123 | final pd = ProgressDialog(context: context); 124 | pd.show( 125 | msg: message, 126 | msgColor: theme.textTheme.bodyMedium!.color!, 127 | msgFontWeight: theme.textTheme.bodyMedium!.fontWeight!, 128 | backgroundColor: theme.dialogBackgroundColor, 129 | max: 100, 130 | hideValue: true, 131 | barrierColor: Colors.black54, 132 | progressBgColor: Colors.transparent, 133 | borderRadius: 4, 134 | ); 135 | return pd; 136 | } 137 | -------------------------------------------------------------------------------- /lib/utils/file_output.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:io'; 3 | 4 | import 'package:logger/logger.dart'; 5 | 6 | /// Writes the log output to a file. To avoid compile error, copied FileOutput. 7 | /// https://github.com/simc/logger/blob/master/lib/src/outputs/file_output.dart 8 | class TinyVCCFileOutput extends LogOutput { 9 | final File file; 10 | final bool overrideExisting; 11 | final Encoding encoding; 12 | IOSink? _sink; 13 | 14 | TinyVCCFileOutput({ 15 | required this.file, 16 | this.overrideExisting = false, 17 | this.encoding = utf8, 18 | }); 19 | 20 | @override 21 | void init() { 22 | _sink = file.openWrite( 23 | mode: overrideExisting ? FileMode.writeOnly : FileMode.writeOnlyAppend, 24 | encoding: encoding, 25 | ); 26 | } 27 | 28 | @override 29 | void output(OutputEvent event) { 30 | _sink?.writeAll(event.lines, '\n'); 31 | _sink?.writeln(); 32 | } 33 | 34 | @override 35 | void destroy() async { 36 | await _sink?.flush(); 37 | await _sink?.close(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/utils/layout_util.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | enum ScreenSizeClass { small, normal, large } 4 | 5 | ScreenSizeClass getScreenSizeClass(BuildContext context) { 6 | double deviceWidth = MediaQuery.of(context).size.width; 7 | if (deviceWidth < 600) return ScreenSizeClass.small; 8 | if (deviceWidth < 900) return ScreenSizeClass.normal; 9 | return ScreenSizeClass.large; 10 | } 11 | -------------------------------------------------------------------------------- /lib/utils/platform_feature.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/services.dart'; 4 | 5 | class PlatformFeature { 6 | static const _platform = MethodChannel('com.github.kurotu.tiny_vcc/platform'); 7 | 8 | static Future moveToTrash(FileSystemEntity entity) async { 9 | if (await entity.exists() == false) { 10 | final String type; 11 | if (entity is File) { 12 | type = 'File'; 13 | } else if (entity is Directory) { 14 | type = 'Directory'; 15 | } else if (entity is Link) { 16 | type = 'Link'; 17 | } else { 18 | type = 'Entity'; 19 | } 20 | throw FileSystemException('$type not found', entity.path); 21 | } 22 | await _platform.invokeMethod('moveToTrash', entity.path); 23 | return entity; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/utils/system_info.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:system_info2/system_info2.dart'; 4 | 5 | enum Architecture { 6 | arm64, 7 | x64, 8 | x86, 9 | unknown, 10 | } 11 | 12 | class SystemInfo { 13 | /// See https://sysinfo.onepub.dev/reference/sysinfo/kernelarchitecture. 14 | static Architecture get arch { 15 | switch (SysInfo.kernelArchitecture) { 16 | case ProcessorArchitecture.arm64: 17 | return Architecture.arm64; 18 | case ProcessorArchitecture.x86_64: 19 | return Architecture.x64; 20 | case ProcessorArchitecture.x86: 21 | return Architecture.x86; 22 | default: 23 | // %PROCESSOR_ARCHITECTURE% may be AMD64 on Windows 11. 24 | if (Platform.isWindows && SysInfo.rawKernelArchitecture == 'AMD64') { 25 | return Architecture.x64; 26 | } 27 | return Architecture.unknown; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/widgets/console_dialog.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:xterm/xterm.dart'; 4 | 5 | class ConsoleDialog extends ConsumerWidget { 6 | const ConsoleDialog({ 7 | super.key, 8 | required this.title, 9 | required this.terminal, 10 | this.actions, 11 | }); 12 | 13 | final String title; 14 | final Terminal terminal; 15 | final List? actions; 16 | 17 | @override 18 | Widget build(BuildContext context, WidgetRef ref) { 19 | return AlertDialog( 20 | title: Text(title), 21 | content: SizedBox( 22 | width: MediaQuery.of(context).size.width, 23 | height: MediaQuery.of(context).size.height, 24 | child: TerminalView(terminal), 25 | ), 26 | actions: actions, 27 | ); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/widgets/copyable_text.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/services.dart'; 3 | 4 | class CopyableText extends StatelessWidget { 5 | CopyableText(this.text); 6 | 7 | final String text; 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Wrap( 12 | crossAxisAlignment: WrapCrossAlignment.center, 13 | children: [ 14 | SelectableText(text), 15 | IconButton( 16 | iconSize: 16, 17 | icon: const Icon(Icons.copy), 18 | tooltip: 'Copy', 19 | onPressed: () async { 20 | final data = ClipboardData(text: text); 21 | await Clipboard.setData(data); 22 | }, 23 | ), 24 | ], 25 | ); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/widgets/m3_speed_dial.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_speed_dial/flutter_speed_dial.dart'; 3 | 4 | SpeedDial m3SpeedDial({ 5 | IconData? icon, 6 | Widget? label, 7 | bool isExtended = false, 8 | bool switchLabelPosition = false, 9 | SpeedDialDirection direction = SpeedDialDirection.up, 10 | List children = const [], 11 | }) { 12 | return SpeedDial( 13 | icon: icon, 14 | label: isExtended ? label : null, 15 | direction: direction, 16 | switchLabelPosition: switchLabelPosition, 17 | shape: const RoundedRectangleBorder( 18 | borderRadius: BorderRadius.all(Radius.circular(16)), 19 | ), 20 | spacing: 16, 21 | childMargin: EdgeInsets.zero, 22 | childPadding: const EdgeInsets.all(8.0), 23 | children: children, 24 | ); 25 | } 26 | 27 | SpeedDialChild m3SpeedDialChild({ 28 | String? label, 29 | Widget? child, 30 | void Function()? onTap, 31 | }) { 32 | return SpeedDialChild( 33 | label: label, 34 | child: child, 35 | onTap: onTap, 36 | shape: const RoundedRectangleBorder( 37 | borderRadius: BorderRadius.all(Radius.circular(12)), 38 | ), 39 | ); 40 | } 41 | -------------------------------------------------------------------------------- /lib/widgets/navigation_scaffold.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class NavigationScaffold extends Scaffold { 4 | NavigationScaffold({ 5 | AppBar? appBar, 6 | required bool useNavigationRail, 7 | required Widget drawer, 8 | required NavigationRail navigationRail, 9 | required Widget body, 10 | Widget? floatingActionButton, 11 | super.key, 12 | }) : super( 13 | appBar: appBar, 14 | drawer: useNavigationRail ? null : drawer, 15 | body: useNavigationRail 16 | ? Row(children: [ 17 | navigationRail, 18 | const VerticalDivider(thickness: 1, width: 1), 19 | Expanded(child: body), 20 | ]) 21 | : body, 22 | floatingActionButton: floatingActionButton, 23 | ); 24 | } 25 | -------------------------------------------------------------------------------- /lib/widgets/new_project_dialog.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 5 | import 'package:tiny_vcc/widgets/new_project_form.dart'; 6 | 7 | import '../providers.dart'; 8 | import '../services/vcc_service.dart'; 9 | 10 | final _formKeyProvider = 11 | Provider.autoDispose((ref) => GlobalKey()); 12 | 13 | class NewProjectDialog extends ConsumerWidget { 14 | const NewProjectDialog({ 15 | super.key, 16 | required this.templates, 17 | required this.onPressedCreate, 18 | required this.defaultLocation, 19 | required this.onClickLocationButton, 20 | }); 21 | 22 | final List templates; 23 | final String defaultLocation; 24 | final void Function(NewProjectFormData data) onPressedCreate; 25 | final FutureOr Function() onClickLocationButton; 26 | 27 | void _didClickCreate(GlobalKey key) { 28 | if (!key.currentState!.validate()) { 29 | return; 30 | } 31 | onPressedCreate(NewProjectFormData( 32 | template: key.currentState!.template, 33 | name: key.currentState!.name, 34 | location: key.currentState!.location, 35 | )); 36 | } 37 | 38 | @override 39 | Widget build(BuildContext context, WidgetRef ref) { 40 | final t = ref.watch(translationProvider); 41 | final formKey = ref.watch(_formKeyProvider); 42 | 43 | return AlertDialog( 44 | title: Text(t.new_project.title), 45 | scrollable: true, 46 | content: NewProjectForm( 47 | key: formKey, 48 | formKey: formKey, 49 | templates: templates, 50 | defaultLocation: defaultLocation, 51 | onClickLocationButton: onClickLocationButton, 52 | ), 53 | actions: [ 54 | TextButton( 55 | onPressed: () { 56 | _didClickCreate(formKey); 57 | }, 58 | child: Text(t.new_project.labels.create), 59 | ), 60 | ], 61 | ); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /lib/widgets/new_project_form.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 5 | 6 | import '../providers.dart'; 7 | import '../services/vcc_service.dart'; 8 | 9 | @immutable 10 | class NewProjectFormData { 11 | const NewProjectFormData( 12 | {required this.template, required this.name, required this.location}); 13 | 14 | final VpmTemplate? template; 15 | final String name; 16 | final String location; 17 | 18 | NewProjectFormData copyWith( 19 | {VpmTemplate? template, String? name, String? location}) { 20 | return NewProjectFormData( 21 | template: template ?? this.template, 22 | name: name ?? this.name, 23 | location: location ?? this.location, 24 | ); 25 | } 26 | } 27 | 28 | class NewProjectForm extends ConsumerStatefulWidget { 29 | const NewProjectForm({ 30 | super.key, 31 | required this.formKey, 32 | required this.templates, 33 | required this.defaultLocation, 34 | required this.onClickLocationButton, 35 | }); 36 | 37 | final Key formKey; 38 | final List templates; 39 | final String defaultLocation; 40 | final FutureOr Function() onClickLocationButton; 41 | 42 | @override 43 | NewProjectFormState createState() { 44 | return NewProjectFormState(); 45 | } 46 | } 47 | 48 | class NewProjectFormState extends ConsumerState { 49 | VpmTemplate? template; 50 | String name = ''; 51 | String location = ''; 52 | 53 | final _formKey = GlobalKey(); 54 | final _nameController = TextEditingController(); 55 | final _locationController = TextEditingController(); 56 | 57 | bool validate() { 58 | if (_formKey.currentState == null) { 59 | return false; 60 | } 61 | return _formKey.currentState!.validate(); 62 | } 63 | 64 | Future _didClickLocationButton( 65 | TextEditingController locationController) async { 66 | final l = await widget.onClickLocationButton(); 67 | if (l != null) { 68 | setState(() { 69 | location = l; 70 | locationController.text = l; 71 | }); 72 | } 73 | } 74 | 75 | @override 76 | void initState() { 77 | super.initState(); 78 | location = widget.defaultLocation; 79 | _locationController.text = widget.defaultLocation; 80 | } 81 | 82 | @override 83 | Widget build(BuildContext context) { 84 | final t = ref.watch(translationProvider); 85 | 86 | return Form( 87 | key: _formKey, 88 | child: Column( 89 | mainAxisSize: MainAxisSize.min, 90 | crossAxisAlignment: CrossAxisAlignment.start, 91 | children: [ 92 | DropdownButtonFormField( 93 | key: const ValueKey('template_dropdown'), 94 | decoration: InputDecoration( 95 | labelText: t.new_project.labels.project_template), 96 | value: template, 97 | items: widget.templates 98 | .map((e) => DropdownMenuItem( 99 | value: e, 100 | child: Text(e.name), 101 | )) 102 | .toList(), 103 | validator: (value) => value == null 104 | ? t.new_project.errors.select_project_template 105 | : null, 106 | onChanged: (value) { 107 | if (value != null) { 108 | setState(() { 109 | template = value; 110 | }); 111 | } 112 | }, 113 | ), 114 | TextFormField( 115 | decoration: 116 | InputDecoration(labelText: t.new_project.labels.project_name), 117 | controller: _nameController, 118 | onChanged: (value) { 119 | setState(() { 120 | name = value; 121 | }); 122 | }, 123 | validator: (value) { 124 | if (value == null || value.isEmpty) { 125 | return t.new_project.errors.enter_project_name; 126 | } 127 | return null; 128 | }, 129 | ), 130 | TextFormField( 131 | readOnly: true, 132 | controller: _locationController, 133 | decoration: InputDecoration( 134 | labelText: t.new_project.labels.location, 135 | suffixIcon: IconButton( 136 | onPressed: () { 137 | _didClickLocationButton(_locationController); 138 | }, 139 | icon: const Icon(Icons.folder), 140 | ), 141 | ), 142 | validator: (value) { 143 | if (value == null || value.isEmpty) { 144 | return t.new_project.errors.enter_location_path; 145 | } 146 | return null; 147 | }, 148 | ), 149 | ], 150 | ), 151 | ); 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /lib/widgets/package_list_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:pub_semver/pub_semver.dart'; 4 | 5 | import '../providers.dart'; 6 | import '../services/vcc_service.dart'; 7 | 8 | class PackageItem { 9 | PackageItem({ 10 | required this.name, 11 | required this.displayName, 12 | required this.description, 13 | this.installedVersion, 14 | this.selectedVersion, 15 | required this.versions, 16 | required this.repoType, 17 | }); 18 | 19 | final String name; 20 | final String displayName; 21 | final String description; 22 | final Version? installedVersion; 23 | final Version? selectedVersion; 24 | final List versions; 25 | final RepositoryType repoType; 26 | } 27 | 28 | class PackageListItem extends StatelessWidget { 29 | const PackageListItem({ 30 | super.key, 31 | required this.item, 32 | required this.onSelect, 33 | required this.onClickAdd, 34 | required this.onClickUpdate, 35 | required this.onClickRemove, 36 | }); 37 | 38 | final PackageItem item; 39 | final void Function(String name, Version version) onSelect; 40 | final void Function(String name) onClickAdd; 41 | final void Function(String name) onClickUpdate; 42 | final void Function(String name) onClickRemove; 43 | 44 | @override 45 | Widget build(BuildContext context) { 46 | return Padding( 47 | padding: const EdgeInsets.fromLTRB(16, 13, 16, 0), 48 | child: Column( 49 | crossAxisAlignment: CrossAxisAlignment.start, 50 | children: [ 51 | _buildTitle(context), 52 | Text( 53 | item.description, 54 | style: Theme.of(context).textTheme.caption?.copyWith(fontSize: 14), 55 | ), 56 | _ActionRow( 57 | canRemove: item.name != 'com.vrchat.base' && 58 | item.name != 'com.vrchat.core.vpm-resolver', 59 | selectedVersion: item.selectedVersion, 60 | installedVersion: item.installedVersion, 61 | availableVersions: item.versions.map((e) => e.version).toList(), 62 | onSelectVersion: (version) { 63 | onSelect(item.name, version); 64 | }, 65 | onClickRemove: () { 66 | onClickRemove(item.name); 67 | }, 68 | onClickAdd: () { 69 | onClickAdd(item.name); 70 | }, 71 | onClickUpdate: () { 72 | onClickUpdate(item.name); 73 | }, 74 | ), 75 | ], 76 | ), 77 | ); 78 | } 79 | 80 | Widget _buildTitle(BuildContext context) { 81 | final children = [ 82 | Text( 83 | item.installedVersion != null 84 | ? "${item.displayName} (${item.installedVersion})" 85 | : item.displayName, 86 | style: const TextStyle(fontSize: 16), 87 | ), 88 | (() { 89 | switch (item.repoType) { 90 | case RepositoryType.official: 91 | return const Chip(label: Text('official')); 92 | case RepositoryType.curated: 93 | return const Chip(label: Text('curated')); 94 | case RepositoryType.user: 95 | return const Chip(label: Text('user')); 96 | case RepositoryType.local: 97 | return const Chip(label: Text('local')); 98 | } 99 | })(), 100 | ]; 101 | if (item.installedVersion != null) { 102 | children.add(const Chip(label: Text('installed'))); 103 | } 104 | return Wrap( 105 | crossAxisAlignment: WrapCrossAlignment.center, 106 | spacing: 8, 107 | runSpacing: 4, 108 | children: children, 109 | ); 110 | } 111 | } 112 | 113 | class _ActionRow extends ConsumerWidget { 114 | const _ActionRow({ 115 | required this.canRemove, 116 | required this.selectedVersion, 117 | this.installedVersion, 118 | required this.availableVersions, 119 | this.onSelectVersion, 120 | this.onClickAdd, 121 | this.onClickUpdate, 122 | this.onClickRemove, 123 | }); 124 | 125 | final bool canRemove; 126 | final Version? selectedVersion; 127 | final Version? installedVersion; 128 | final List availableVersions; 129 | final void Function(Version version)? onSelectVersion; 130 | final void Function()? onClickAdd; 131 | final void Function()? onClickUpdate; 132 | final void Function()? onClickRemove; 133 | 134 | @override 135 | Widget build(BuildContext context, WidgetRef ref) { 136 | return Row( 137 | children: _getChildren(ref), 138 | ); 139 | } 140 | 141 | List _getChildren(WidgetRef ref) { 142 | final t = ref.watch(translationProvider); 143 | List children = []; 144 | if (installedVersion == null) { 145 | children.add(OutlinedButton( 146 | onPressed: onClickAdd, child: Text(t.project.labels.add))); 147 | children.add(const Padding( 148 | padding: EdgeInsets.symmetric(horizontal: 4), 149 | )); 150 | } else if (canRemove) { 151 | children.add(OutlinedButton( 152 | onPressed: onClickRemove, child: Text(t.project.labels.remove))); 153 | children.add(const Padding( 154 | padding: EdgeInsets.symmetric(horizontal: 4), 155 | )); 156 | } 157 | 158 | children.add(DropdownButton( 159 | value: selectedVersion, 160 | items: availableVersions 161 | .map((v) => DropdownMenuItem(value: v, child: Text(v.toString()))) 162 | .toList(), 163 | onChanged: (v) { 164 | onSelectVersion!(v!); 165 | }, 166 | )); 167 | 168 | if (installedVersion != null && selectedVersion != null) { 169 | if (installedVersion != selectedVersion) { 170 | children.add(const Padding( 171 | padding: EdgeInsets.symmetric(horizontal: 4), 172 | )); 173 | final compare = selectedVersion!.compareTo(installedVersion!); 174 | if (compare > 0) { 175 | children.add(ElevatedButton( 176 | onPressed: onClickUpdate, child: Text(t.project.labels.update))); 177 | } else { 178 | children.add(ElevatedButton( 179 | onPressed: onClickUpdate, 180 | child: Text(t.project.labels.downgrade))); 181 | } 182 | } 183 | } 184 | return children; 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.10) 3 | project(runner LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "tiny_vcc") 8 | # The unique GTK application identifier for this application. See: 9 | # https://developer.gnome.org/documentation/tutorials/application-id.html 10 | set(APPLICATION_ID "com.github.kurotu.tiny_vcc") 11 | 12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 13 | # versions of CMake. 14 | cmake_policy(SET CMP0063 NEW) 15 | 16 | # Load bundled libraries from the lib/ directory relative to the binary. 17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 18 | 19 | # Root filesystem for cross-building. 20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 27 | endif() 28 | 29 | # Define build configuration options. 30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 31 | set(CMAKE_BUILD_TYPE "Debug" CACHE 32 | STRING "Flutter build mode" FORCE) 33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 34 | "Debug" "Profile" "Release") 35 | endif() 36 | 37 | # Compilation settings that should be applied to most targets. 38 | # 39 | # Be cautious about adding new options here, as plugins use this function by 40 | # default. In most cases, you should add new options to specific targets instead 41 | # of modifying this function. 42 | function(APPLY_STANDARD_SETTINGS TARGET) 43 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 47 | endfunction() 48 | 49 | # Flutter library and tool build rules. 50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 51 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 52 | 53 | # System-level dependencies. 54 | find_package(PkgConfig REQUIRED) 55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 56 | 57 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 58 | 59 | # Define the application target. To change its name, change BINARY_NAME above, 60 | # not the value here, or `flutter run` will no longer work. 61 | # 62 | # Any new source files that you add to the application should be added here. 63 | add_executable(${BINARY_NAME} 64 | "main.cc" 65 | "my_application.cc" 66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 67 | "functions.cc" 68 | ) 69 | 70 | # Apply the standard set of build settings. This can be removed for applications 71 | # that need different build settings. 72 | apply_standard_settings(${BINARY_NAME}) 73 | 74 | # Add dependency libraries. Add any application-specific dependencies here. 75 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 76 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 77 | 78 | # Run the Flutter tool portions of the build. This must not be removed. 79 | add_dependencies(${BINARY_NAME} flutter_assemble) 80 | 81 | # Only the install-generated bundle's copy of the executable will launch 82 | # correctly, since the resources must in the right relative locations. To avoid 83 | # people trying to run the unbundled copy, put it in a subdirectory instead of 84 | # the default top-level location. 85 | set_target_properties(${BINARY_NAME} 86 | PROPERTIES 87 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 88 | ) 89 | 90 | # Generated plugin build rules, which manage building the plugins and adding 91 | # them to the application. 92 | include(flutter/generated_plugins.cmake) 93 | 94 | 95 | # === Installation === 96 | # By default, "installing" just makes a relocatable bundle in the build 97 | # directory. 98 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 99 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 100 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 101 | endif() 102 | 103 | # Start with a clean build bundle directory every time. 104 | install(CODE " 105 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 106 | " COMPONENT Runtime) 107 | 108 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 109 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 110 | 111 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 112 | COMPONENT Runtime) 113 | 114 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 115 | COMPONENT Runtime) 116 | 117 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 118 | COMPONENT Runtime) 119 | 120 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 121 | install(FILES "${bundled_library}" 122 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 123 | COMPONENT Runtime) 124 | endforeach(bundled_library) 125 | 126 | # Fully re-copy the assets directory on each build to avoid having stale files 127 | # from a previous install. 128 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 129 | install(CODE " 130 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 131 | " COMPONENT Runtime) 132 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 133 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 134 | 135 | # Install the AOT library on non-Debug builds only. 136 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 137 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 138 | COMPONENT Runtime) 139 | endif() 140 | -------------------------------------------------------------------------------- /linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.10) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | 12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 13 | # which isn't available in 3.10. 14 | function(list_prepend LIST_NAME PREFIX) 15 | set(NEW_LIST "") 16 | foreach(element ${${LIST_NAME}}) 17 | list(APPEND NEW_LIST "${PREFIX}${element}") 18 | endforeach(element) 19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 20 | endfunction() 21 | 22 | # === Flutter Library === 23 | # System-level dependencies. 24 | find_package(PkgConfig REQUIRED) 25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 28 | 29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 30 | 31 | # Published to parent scope for install step. 32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 36 | 37 | list(APPEND FLUTTER_LIBRARY_HEADERS 38 | "fl_basic_message_channel.h" 39 | "fl_binary_codec.h" 40 | "fl_binary_messenger.h" 41 | "fl_dart_project.h" 42 | "fl_engine.h" 43 | "fl_json_message_codec.h" 44 | "fl_json_method_codec.h" 45 | "fl_message_codec.h" 46 | "fl_method_call.h" 47 | "fl_method_channel.h" 48 | "fl_method_codec.h" 49 | "fl_method_response.h" 50 | "fl_plugin_registrar.h" 51 | "fl_plugin_registry.h" 52 | "fl_standard_message_codec.h" 53 | "fl_standard_method_codec.h" 54 | "fl_string_codec.h" 55 | "fl_value.h" 56 | "fl_view.h" 57 | "flutter_linux.h" 58 | ) 59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 60 | add_library(flutter INTERFACE) 61 | target_include_directories(flutter INTERFACE 62 | "${EPHEMERAL_DIR}" 63 | ) 64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 65 | target_link_libraries(flutter INTERFACE 66 | PkgConfig::GTK 67 | PkgConfig::GLIB 68 | PkgConfig::GIO 69 | ) 70 | add_dependencies(flutter flutter_assemble) 71 | 72 | # === Flutter tool backend === 73 | # _phony_ is a non-existent file to force this command to run every time, 74 | # since currently there's no way to get a full input/output list from the 75 | # flutter tool. 76 | add_custom_command( 77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 79 | COMMAND ${CMAKE_COMMAND} -E env 80 | ${FLUTTER_TOOL_ENVIRONMENT} 81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 83 | VERBATIM 84 | ) 85 | add_custom_target(flutter_assemble DEPENDS 86 | "${FLUTTER_LIBRARY}" 87 | ${FLUTTER_LIBRARY_HEADERS} 88 | ) 89 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | 11 | void fl_register_plugins(FlPluginRegistry* registry) { 12 | g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = 13 | fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); 14 | url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); 15 | } 16 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | url_launcher_linux 7 | ) 8 | 9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /linux/functions.cc: -------------------------------------------------------------------------------- 1 | #include "functions.h" 2 | 3 | #include 4 | 5 | FlMethodResponse* moveToTrash(const char* path) { 6 | g_autoptr(GFile) file = g_file_new_for_path(path); 7 | g_autoptr(GError) error = nullptr; 8 | auto result = g_file_trash(file, nullptr, &error); 9 | if (result) { 10 | g_autoptr(FlValue) res = fl_value_new_bool(result); 11 | return FL_METHOD_RESPONSE(fl_method_success_response_new(res)); 12 | } else { 13 | return FL_METHOD_RESPONSE(fl_method_error_response_new("MoveToTrash", error->message, nullptr)); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /linux/functions.h: -------------------------------------------------------------------------------- 1 | #ifndef FUNCTIONS_H_ 2 | #define FUNCTIONS_H_ 3 | 4 | #include 5 | 6 | FlMethodResponse* moveToTrash(const char* path); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "functions.h" 9 | #include "flutter/generated_plugin_registrant.h" 10 | 11 | static void method_call_cb(FlMethodChannel *channel, 12 | FlMethodCall *method_call, 13 | gpointer user_data); 14 | 15 | struct _MyApplication { 16 | GtkApplication parent_instance; 17 | char** dart_entrypoint_arguments; 18 | }; 19 | 20 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 21 | 22 | // Implements GApplication::activate. 23 | static void my_application_activate(GApplication* application) { 24 | MyApplication* self = MY_APPLICATION(application); 25 | GtkWindow* window = 26 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 27 | 28 | // Use a header bar when running in GNOME as this is the common style used 29 | // by applications and is the setup most users will be using (e.g. Ubuntu 30 | // desktop). 31 | // If running on X and not using GNOME then just use a traditional title bar 32 | // in case the window manager does more exotic layout, e.g. tiling. 33 | // If running on Wayland assume the header bar will work (may need changing 34 | // if future cases occur). 35 | gboolean use_header_bar = TRUE; 36 | #ifdef GDK_WINDOWING_X11 37 | GdkScreen* screen = gtk_window_get_screen(window); 38 | if (GDK_IS_X11_SCREEN(screen)) { 39 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 40 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 41 | use_header_bar = FALSE; 42 | } 43 | } 44 | #endif 45 | if (use_header_bar) { 46 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 47 | gtk_widget_show(GTK_WIDGET(header_bar)); 48 | gtk_header_bar_set_title(header_bar, "Tiny VCC"); 49 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 50 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 51 | } else { 52 | gtk_window_set_title(window, "Tiny VCC"); 53 | } 54 | 55 | gtk_window_set_default_size(window, 1280, 720); 56 | gtk_widget_show(GTK_WIDGET(window)); 57 | 58 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 59 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 60 | 61 | FlView* view = fl_view_new(project); 62 | gtk_widget_show(GTK_WIDGET(view)); 63 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 64 | 65 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 66 | 67 | // Set up method channel. 68 | FlEngine *engine = fl_view_get_engine(view); 69 | g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new(); 70 | g_autoptr(FlBinaryMessenger) messenger = fl_engine_get_binary_messenger(engine); 71 | g_autoptr(FlMethodChannel) channel = fl_method_channel_new( 72 | messenger, "com.github.kurotu.tiny_vcc/platform", FL_METHOD_CODEC(codec)); 73 | fl_method_channel_set_method_call_handler( 74 | channel, method_call_cb, g_object_ref(view), g_object_unref); 75 | 76 | gtk_widget_grab_focus(GTK_WIDGET(view)); 77 | } 78 | 79 | // Implements GApplication::local_command_line. 80 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 81 | MyApplication* self = MY_APPLICATION(application); 82 | // Strip out the first argument as it is the binary name. 83 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 84 | 85 | g_autoptr(GError) error = nullptr; 86 | if (!g_application_register(application, nullptr, &error)) { 87 | g_warning("Failed to register: %s", error->message); 88 | *exit_status = 1; 89 | return TRUE; 90 | } 91 | 92 | g_application_activate(application); 93 | *exit_status = 0; 94 | 95 | return TRUE; 96 | } 97 | 98 | // Implements GObject::dispose. 99 | static void my_application_dispose(GObject* object) { 100 | MyApplication* self = MY_APPLICATION(object); 101 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 102 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 103 | } 104 | 105 | static void my_application_class_init(MyApplicationClass* klass) { 106 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 107 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 108 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 109 | } 110 | 111 | static void my_application_init(MyApplication* self) {} 112 | 113 | MyApplication* my_application_new() { 114 | return MY_APPLICATION(g_object_new(my_application_get_type(), 115 | "application-id", APPLICATION_ID, 116 | "flags", G_APPLICATION_NON_UNIQUE, 117 | nullptr)); 118 | } 119 | 120 | static void method_call_cb(FlMethodChannel *channel, 121 | FlMethodCall *method_call, 122 | gpointer user_data) { 123 | g_autoptr(FlMethodResponse) response = nullptr; 124 | const gchar *method = fl_method_call_get_name(method_call); 125 | if (strcmp(method, "moveToTrash") == 0) { 126 | FlValue* args = fl_method_call_get_args(method_call); 127 | auto *text_value = fl_value_get_string(args); 128 | response = moveToTrash(text_value); 129 | } else { 130 | response = FL_METHOD_RESPONSE(fl_method_not_implemented_response_new()); 131 | } 132 | g_autoptr(GError) error = nullptr; 133 | fl_method_call_respond(method_call, response, &error); 134 | } 135 | -------------------------------------------------------------------------------- /linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import package_info_plus 9 | import path_provider_foundation 10 | import url_launcher_macos 11 | 12 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 13 | FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) 14 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 15 | UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) 16 | } 17 | -------------------------------------------------------------------------------- /macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.14' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | end 35 | 36 | post_install do |installer| 37 | installer.pods_project.targets.each do |target| 38 | flutter_additional_macos_build_settings(target) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /macos/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - FlutterMacOS (1.0.0) 3 | - package_info_plus (0.0.1): 4 | - FlutterMacOS 5 | - path_provider_foundation (0.0.1): 6 | - Flutter 7 | - FlutterMacOS 8 | - url_launcher_macos (0.0.1): 9 | - FlutterMacOS 10 | 11 | DEPENDENCIES: 12 | - FlutterMacOS (from `Flutter/ephemeral`) 13 | - package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`) 14 | - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/macos`) 15 | - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) 16 | 17 | EXTERNAL SOURCES: 18 | FlutterMacOS: 19 | :path: Flutter/ephemeral 20 | package_info_plus: 21 | :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos 22 | path_provider_foundation: 23 | :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/macos 24 | url_launcher_macos: 25 | :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos 26 | 27 | SPEC CHECKSUMS: 28 | FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 29 | package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce 30 | path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852 31 | url_launcher_macos: c04e4fa86382d4f94f6b38f14625708be3ae52e2 32 | 33 | PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 34 | 35 | COCOAPODS: 1.13.0 36 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationDidFinishLaunching(_ notification: Notification) { 7 | let controller : FlutterViewController = mainFlutterWindow?.contentViewController as! FlutterViewController 8 | let channel = FlutterMethodChannel.init(name: "com.github.kurotu.tiny_vcc/platform", binaryMessenger: controller.engine.binaryMessenger) 9 | channel.setMethodCallHandler({ 10 | (_ call: FlutterMethodCall, _ result: FlutterResult) -> Void in 11 | switch call.method { 12 | case "moveToTrash": 13 | let arguments = call.arguments 14 | let path = arguments as! String 15 | do { 16 | try moveToTrash(path:path) 17 | result(nil) 18 | } catch { 19 | result(FlutterError(code: "MoveToTrash", message: error.localizedDescription, details: "\(error)")) 20 | } 21 | default: 22 | result(FlutterMethodNotImplemented) 23 | } 24 | }); 25 | } 26 | 27 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 28 | return true 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "version": 1, 4 | "author": "xcode" 5 | }, 6 | "images": [ 7 | { 8 | "size": "16x16", 9 | "idiom": "mac", 10 | "filename": "app_icon_16.png", 11 | "scale": "1x" 12 | }, 13 | { 14 | "size": "16x16", 15 | "idiom": "mac", 16 | "filename": "app_icon_32.png", 17 | "scale": "2x" 18 | }, 19 | { 20 | "size": "32x32", 21 | "idiom": "mac", 22 | "filename": "app_icon_32.png", 23 | "scale": "1x" 24 | }, 25 | { 26 | "size": "32x32", 27 | "idiom": "mac", 28 | "filename": "app_icon_64.png", 29 | "scale": "2x" 30 | }, 31 | { 32 | "size": "128x128", 33 | "idiom": "mac", 34 | "filename": "app_icon_128.png", 35 | "scale": "1x" 36 | }, 37 | { 38 | "size": "128x128", 39 | "idiom": "mac", 40 | "filename": "app_icon_256.png", 41 | "scale": "2x" 42 | }, 43 | { 44 | "size": "256x256", 45 | "idiom": "mac", 46 | "filename": "app_icon_256.png", 47 | "scale": "1x" 48 | }, 49 | { 50 | "size": "256x256", 51 | "idiom": "mac", 52 | "filename": "app_icon_512.png", 53 | "scale": "2x" 54 | }, 55 | { 56 | "size": "512x512", 57 | "idiom": "mac", 58 | "filename": "app_icon_512.png", 59 | "scale": "1x" 60 | }, 61 | { 62 | "size": "512x512", 63 | "idiom": "mac", 64 | "filename": "app_icon_1024.png", 65 | "scale": "2x" 66 | } 67 | ] 68 | } -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = Tiny VCC 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.github.kurotu.tiny-vcc 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2022 kurotu. 15 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /macos/Runner/Functions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Functions.swift 3 | // Runner 4 | // 5 | // Created by kurotu on 2023/01/04. 6 | // 7 | 8 | import Foundation 9 | 10 | func moveToTrash(path: String) throws { 11 | let fileURL = URL(fileURLWithPath: path) 12 | let fileManager = FileManager.default 13 | try fileManager.trashItem(at: fileURL, resultingItemURL: nil) 14 | } 15 | -------------------------------------------------------------------------------- /macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: tiny_vcc 2 | description: Yet another VRChat Creator Companion. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | # In Windows, build-name is used as the major, minor, and patch parts 19 | # of the product and file versions while build-number is used as the build suffix. 20 | version: 0.6.1 21 | 22 | environment: 23 | sdk: '>=2.18.5 <3.0.0' 24 | 25 | # Dependencies specify other packages that your package needs in order to work. 26 | # To automatically upgrade your package dependencies to the latest versions 27 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 28 | # dependencies can be manually updated by changing the version numbers below to 29 | # the latest version available on pub.dev. To see which dependencies have newer 30 | # versions available, run `flutter pub outdated`. 31 | dependencies: 32 | flutter: 33 | sdk: flutter 34 | flutter_localizations: 35 | sdk: flutter 36 | 37 | # The following adds the Cupertino Icons font to your application. 38 | # Use with the CupertinoIcons class for iOS style icons. 39 | cupertino_icons: ^1.0.2 40 | path_provider: ^2.0.11 41 | path: ^1.8.2 42 | file_picker: ^5.2.2 43 | yaml: ^3.1.1 44 | pub_semver: ^2.1.3 45 | github: ^9.7.0 46 | url_launcher: ^6.1.7 47 | archive: ^3.3.5 48 | intl: ^0.17.0 49 | sn_progress_dialog: ^1.0.9 50 | package_info_plus: ^3.0.2 51 | logger: ^1.1.0 52 | flutter_riverpod: ^2.1.3 53 | system_info2: ^4.0.0 54 | http: ^0.13.5 55 | xterm: ^3.4.0 56 | slang: ^3.7.0 57 | slang_flutter: ^3.7.0 58 | flutter_speed_dial: ^6.2.0 59 | tuple: ^2.0.2 60 | 61 | dev_dependencies: 62 | flutter_test: 63 | sdk: flutter 64 | 65 | # The "flutter_lints" package below contains a set of recommended lints to 66 | # encourage good coding practices. The lint set provided by the package is 67 | # activated in the `analysis_options.yaml` file located at the root of your 68 | # package. See that file for information about deactivating specific lint 69 | # rules and activating additional ones. 70 | flutter_lints: ^2.0.0 71 | flutter_launcher_icons: ^0.11.0 72 | 73 | # For information on the generic Dart part of this file, see the 74 | # following page: https://dart.dev/tools/pub/pubspec 75 | 76 | # The following section is specific to Flutter packages. 77 | flutter: 78 | 79 | # The following line ensures that the Material Icons font is 80 | # included with your application, so that you can use the icons in 81 | # the material Icons class. 82 | uses-material-design: true 83 | 84 | # To add assets to your application, add an assets section, like this: 85 | assets: 86 | - assets/images/app_icon-1024x1024.png 87 | - assets/texts/LICENSE_NOTICE 88 | 89 | # An image asset can refer to one or more resolution-specific "variants", see 90 | # https://flutter.dev/assets-and-images/#resolution-aware 91 | 92 | # For details regarding adding assets from package dependencies, see 93 | # https://flutter.dev/assets-and-images/#from-packages 94 | 95 | # To add custom fonts to your application, add a fonts section here, 96 | # in this "flutter" section. Each entry in this list should have a 97 | # "family" key with the font family name, and a "fonts" key with a 98 | # list giving the asset and other descriptors for the font. For 99 | # example: 100 | # fonts: 101 | # - family: Schyler 102 | # fonts: 103 | # - asset: fonts/Schyler-Regular.ttf 104 | # - asset: fonts/Schyler-Italic.ttf 105 | # style: italic 106 | # - family: Trajan Pro 107 | # fonts: 108 | # - asset: fonts/TrajanPro.ttf 109 | # - asset: fonts/TrajanPro_Bold.ttf 110 | # weight: 700 111 | # 112 | # For details regarding fonts from package dependencies, 113 | # see https://flutter.dev/custom-fonts/#from-packages 114 | 115 | flutter_icons: 116 | image_path: "assets/images/app_icon-1024x1024.png" 117 | windows: 118 | generate: true 119 | icon_size: 256 120 | -------------------------------------------------------------------------------- /scripts/bump-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eu 3 | 4 | VERSION="${1}" 5 | sed -i -b -e "s/^version:.*/version: ${VERSION}/g" pubspec.yaml 6 | sed -i -b -e "s/\[Unreleased\]/\[${VERSION}\] - $(date -I)/g" CHANGELOG*.md 7 | sed -i -b -e "s/\"ProductVersion\" = \".*\"/\"ProductVersion\" = \"8:${VERSION}\"/g" installer/TinyVccInstaller/TinyVccInstaller/TinyVccInstaller.vdproj 8 | 9 | if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" || "$OSTYPE" == "cygwin" ]]; then 10 | pwsh.exe -ExecutionPolicy RemoteSigned -File scripts/update-product-code.ps1 11 | fi 12 | 13 | git commit -am "Version ${VERSION}" 14 | git tag "v${VERSION}" 15 | -------------------------------------------------------------------------------- /scripts/create-dmg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eu 3 | 4 | APP_DIR="${1}" 5 | APP="$(basename "${APP_DIR}")" 6 | DMG="${2}" 7 | 8 | rm -f "${DMG}" 9 | 10 | create-dmg \ 11 | --window-pos 200 120 \ 12 | --window-size 800 400 \ 13 | --icon-size 100 \ 14 | --icon "${APP}" 200 190 \ 15 | --hide-extension "${APP}" \ 16 | --app-drop-link 600 185 \ 17 | "${DMG}" \ 18 | "${APP_DIR}" 19 | -------------------------------------------------------------------------------- /scripts/generate-releasenote.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eu 3 | 4 | function printVersionBody() { 5 | local FILE=$1 6 | local VERSION=$2 7 | sed -n "/^## \[${VERSION}\]/,/^## /p" "${FILE}" \ 8 | | tail -n +2 \ 9 | | head -n -1 10 | } 11 | 12 | VERSION="${1}" 13 | 14 | echo "## What's Changed" 15 | printVersionBody CHANGELOG.md "${VERSION}" 16 | echo '## 変更点' 17 | printVersionBody CHANGELOG_JP.md "${VERSION}" 18 | -------------------------------------------------------------------------------- /scripts/update-product-code.ps1: -------------------------------------------------------------------------------- 1 | # Generate GUIDs 2 | $PRODUCT_CODE = [guid]::NewGuid().ToString().ToUpper() 3 | $PACKAGE_CODE = [guid]::NewGuid().ToString().ToUpper() 4 | 5 | # Replace GUIDs in vdproj file 6 | $FILE = "installer\TinyVccInstaller\TinyVccInstaller\TinyVccInstaller.vdproj" 7 | (Get-Content $FILE) | Foreach-Object { $_ -replace """ProductCode"" = ""8:{.*}""", """ProductCode"" = ""8:{$PRODUCT_CODE}""" } | Set-Content -Encoding utf8bom $FILE 8 | (Get-Content $FILE) | Foreach-Object { $_ -replace """PackageCode"" = ""8:{.*}""", """PackageCode"" = ""8:{$PACKAGE_CODE}""" } | Set-Content -Encoding utf8bom $FILE 9 | -------------------------------------------------------------------------------- /slang.yaml: -------------------------------------------------------------------------------- 1 | fallback_strategy: base_locale 2 | locale_handling: false # remove unused t variable, LocaleSettings, etc. 3 | translation_class_visibility: public 4 | -------------------------------------------------------------------------------- /test/services/unity_hub_service_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:tiny_vcc/services/unity_hub_service.dart'; 3 | 4 | void main() { 5 | test('parseInstalledEditors on Intel', () { 6 | final lines = [ 7 | '2019.4.1f1 , installed at /Applications/Unity/Hub/Editor/2019.4.1f1/Unity.app', 8 | '2020.1.0f1 , installed at /Applications/Unity/Hub/Editor/2020.1.0f1/Unity.app', 9 | ]; 10 | 11 | final expected = { 12 | '2019.4.1f1': '/Applications/Unity/Hub/Editor/2019.4.1f1/Unity.app', 13 | '2020.1.0f1': '/Applications/Unity/Hub/Editor/2020.1.0f1/Unity.app', 14 | }; 15 | 16 | final result = UnityHubOutputParser.parseInstalledEditors(lines); 17 | expect(result, equals(expected)); 18 | }); 19 | 20 | test('parseInstalledEditors on Apple Silicon', () { 21 | final lines = [ 22 | '2019.4.31f1 (Intel), installed at /Applications/Unity/Hub/Editor/2019.4.31f1/Unity.app', 23 | '2020.1.0f1 (Apple silicon), installed at /Applications/Unity/Hub/Editor/2020.1.0f1/Unity.app', 24 | ]; 25 | 26 | final expected = { 27 | '2019.4.31f1': '/Applications/Unity/Hub/Editor/2019.4.31f1/Unity.app', 28 | '2020.1.0f1': '/Applications/Unity/Hub/Editor/2020.1.0f1/Unity.app', 29 | }; 30 | 31 | final result = UnityHubOutputParser.parseInstalledEditors(lines); 32 | expect(result, equals(expected)); 33 | }); 34 | 35 | test('parseInstalledEditors if no editors are installed', () { 36 | final lines = [ 37 | 'No editors installed', 38 | ]; 39 | 40 | final expected = {}; 41 | 42 | final result = UnityHubOutputParser.parseInstalledEditors(lines); 43 | expect(result, equals(expected)); 44 | }); 45 | } 46 | -------------------------------------------------------------------------------- /test/utils/system_info_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter_test/flutter_test.dart'; 4 | import 'package:system_info2/system_info2.dart'; 5 | import 'package:tiny_vcc/utils/system_info.dart'; 6 | 7 | void main() { 8 | test("SysInfo.kernelArchitecture on Mac", () { 9 | final result = Process.runSync('uname', ['-m']); 10 | final architecture = result.stdout.trim(); 11 | if (architecture == 'x86_64') { 12 | expect(SysInfo.kernelArchitecture, ProcessorArchitecture.x86_64); 13 | } else if (architecture == 'arm64') { 14 | expect(SysInfo.kernelArchitecture, ProcessorArchitecture.arm64); 15 | } else { 16 | fail('Unknown architecture: $architecture'); 17 | } 18 | }, skip: !Platform.isMacOS); 19 | 20 | test("SystemInfo.arch on Mac", () { 21 | final result = Process.runSync('uname', ['-m']); 22 | final architecture = result.stdout.trim(); 23 | if (architecture == 'x86_64') { 24 | expect(SystemInfo.arch, Architecture.x64); 25 | } else if (architecture == 'arm64') { 26 | expect(SystemInfo.arch, Architecture.arm64); 27 | } else { 28 | fail('Unknown architecture: $architecture'); 29 | } 30 | }, skip: !Platform.isMacOS); 31 | } 32 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility in the flutter_test package. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:tiny_vcc/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(const ProviderScope(child: MyApp())); 17 | // Wait async tasks 18 | await tester.pumpAndSettle(); 19 | /* 20 | // Verify that our counter starts at 0. 21 | expect(find.text('0'), findsOneWidget); 22 | expect(find.text('1'), findsNothing); 23 | 24 | // Tap the '+' icon and trigger a frame. 25 | await tester.tap(find.byIcon(Icons.add)); 26 | await tester.pump(); 27 | 28 | // Verify that our counter has incremented. 29 | expect(find.text('0'), findsNothing); 30 | expect(find.text('1'), findsOneWidget); 31 | */ 32 | }); 33 | } 34 | -------------------------------------------------------------------------------- /test/widgets/new_project_form_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/rendering.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | import 'package:flutter_test/flutter_test.dart'; 5 | import 'package:tiny_vcc/services/vcc_service.dart'; 6 | 7 | import 'package:tiny_vcc/widgets/new_project_form.dart'; 8 | 9 | RenderEditable findRenderEditable(WidgetTester tester, int index) { 10 | final RenderObject root = tester.renderObject( 11 | find.byType(EditableText).at(index)); // 対象のフィールドのRenderObjectを取得 12 | expect(root, isNotNull); 13 | 14 | late RenderEditable renderEditable; 15 | void recursiveFinder(RenderObject child) { 16 | if (child is RenderEditable) { 17 | renderEditable = child; 18 | return; 19 | } 20 | child.visitChildren(recursiveFinder); // 再帰的に処理する 21 | } 22 | 23 | root.visitChildren(recursiveFinder); 24 | expect(renderEditable, isNotNull); 25 | return renderEditable; 26 | } 27 | 28 | void main() { 29 | testWidgets('NewProjectForm', (WidgetTester tester) async { 30 | // Build our app and trigger a frame. 31 | final formKey = GlobalKey(); 32 | final templates = [ 33 | VpmTemplate('avatar', '/PATH/TO/AVATAR_TEMPLATE'), 34 | VpmTemplate('world', '/PATH/TO/WORLD_TEMPLATE'), 35 | ]; 36 | const defaultLocation = '/PATH/TO/LOCATION'; 37 | await tester.pumpWidget(ProviderScope( 38 | child: MaterialApp( 39 | home: Scaffold( 40 | body: NewProjectForm( 41 | formKey: formKey, 42 | templates: templates, 43 | defaultLocation: defaultLocation, 44 | onClickLocationButton: () { 45 | return '/PATH/TO/NEW_LOCATION'; 46 | }, 47 | ), 48 | ), 49 | ), 50 | )); 51 | 52 | final NewProjectFormState state = tester.state(find.byType(NewProjectForm)); 53 | expect(state.template, null); 54 | expect(state.name, ''); 55 | expect(state.location, '/PATH/TO/LOCATION'); 56 | expect(state.validate(), false); 57 | 58 | final dropdown = find.byKey(const ValueKey('template_dropdown')); 59 | await tester.tap(dropdown); 60 | await tester.pumpAndSettle(); 61 | await tester.tap(find.text('avatar').last); 62 | await tester.pump(); 63 | expect(state.template, templates[0]); 64 | 65 | const nameFieldIndex = 0; 66 | final nameField = find.byType(TextFormField).at(nameFieldIndex); 67 | expect(findRenderEditable(tester, nameFieldIndex).text?.toPlainText(), ''); 68 | await tester.enterText(nameField, 'NAME'); 69 | await tester.pump(); 70 | expect( 71 | findRenderEditable(tester, nameFieldIndex).text?.toPlainText(), 'NAME'); 72 | 73 | const locationFieldIndex = 1; 74 | expect(findRenderEditable(tester, locationFieldIndex).text?.toPlainText(), 75 | '/PATH/TO/LOCATION'); 76 | await tester.tap(find.byIcon(Icons.folder)); 77 | await tester.pump(); 78 | expect(findRenderEditable(tester, locationFieldIndex).text?.toPlainText(), 79 | '/PATH/TO/NEW_LOCATION'); 80 | 81 | expect(state.validate(), true); 82 | }); 83 | } 84 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | tiny_vcc 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tiny_vcc", 3 | "short_name": "tiny_vcc", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(tiny_vcc LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "tiny_vcc") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(SET CMP0063 NEW) 12 | 13 | # Define build configuration option. 14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 15 | if(IS_MULTICONFIG) 16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 17 | CACHE STRING "" FORCE) 18 | else() 19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 20 | set(CMAKE_BUILD_TYPE "Debug" CACHE 21 | STRING "Flutter build mode" FORCE) 22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 23 | "Debug" "Profile" "Release") 24 | endif() 25 | endif() 26 | # Define settings for the Profile build mode. 27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 31 | 32 | # Use Unicode for all projects. 33 | add_definitions(-DUNICODE -D_UNICODE) 34 | 35 | # Compilation settings that should be applied to most targets. 36 | # 37 | # Be cautious about adding new options here, as plugins use this function by 38 | # default. In most cases, you should add new options to specific targets instead 39 | # of modifying this function. 40 | function(APPLY_STANDARD_SETTINGS TARGET) 41 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 43 | target_compile_options(${TARGET} PRIVATE /EHsc) 44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 46 | endfunction() 47 | 48 | # Flutter library and tool build rules. 49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 50 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 51 | 52 | # Application build; see runner/CMakeLists.txt. 53 | add_subdirectory("runner") 54 | 55 | # Generated plugin build rules, which manage building the plugins and adding 56 | # them to the application. 57 | include(flutter/generated_plugins.cmake) 58 | 59 | 60 | # === Installation === 61 | # Support files are copied into place next to the executable, so that it can 62 | # run in place. This is done instead of making a separate bundle (as on Linux) 63 | # so that building and running from within Visual Studio will work. 64 | set(BUILD_BUNDLE_DIR "$") 65 | # Make the "install" step default, as it's required to run. 66 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 67 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 68 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 69 | endif() 70 | 71 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 72 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 73 | 74 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 75 | COMPONENT Runtime) 76 | 77 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 78 | COMPONENT Runtime) 79 | 80 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 81 | COMPONENT Runtime) 82 | 83 | if(PLUGIN_BUNDLED_LIBRARIES) 84 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 85 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 86 | COMPONENT Runtime) 87 | endif() 88 | 89 | # Fully re-copy the assets directory on each build to avoid having stale files 90 | # from a previous install. 91 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 92 | install(CODE " 93 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 94 | " COMPONENT Runtime) 95 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 96 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 97 | 98 | # Install the AOT library on non-Debug builds only. 99 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 100 | CONFIGURATIONS Profile;Release 101 | COMPONENT Runtime) 102 | -------------------------------------------------------------------------------- /windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # === Flutter Library === 14 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 15 | 16 | # Published to parent scope for install step. 17 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 18 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 19 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 20 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 21 | 22 | list(APPEND FLUTTER_LIBRARY_HEADERS 23 | "flutter_export.h" 24 | "flutter_windows.h" 25 | "flutter_messenger.h" 26 | "flutter_plugin_registrar.h" 27 | "flutter_texture_registrar.h" 28 | ) 29 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 30 | add_library(flutter INTERFACE) 31 | target_include_directories(flutter INTERFACE 32 | "${EPHEMERAL_DIR}" 33 | ) 34 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 35 | add_dependencies(flutter flutter_assemble) 36 | 37 | # === Wrapper === 38 | list(APPEND CPP_WRAPPER_SOURCES_CORE 39 | "core_implementations.cc" 40 | "standard_codec.cc" 41 | ) 42 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 43 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 44 | "plugin_registrar.cc" 45 | ) 46 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 47 | list(APPEND CPP_WRAPPER_SOURCES_APP 48 | "flutter_engine.cc" 49 | "flutter_view_controller.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 52 | 53 | # Wrapper sources needed for a plugin. 54 | add_library(flutter_wrapper_plugin STATIC 55 | ${CPP_WRAPPER_SOURCES_CORE} 56 | ${CPP_WRAPPER_SOURCES_PLUGIN} 57 | ) 58 | apply_standard_settings(flutter_wrapper_plugin) 59 | set_target_properties(flutter_wrapper_plugin PROPERTIES 60 | POSITION_INDEPENDENT_CODE ON) 61 | set_target_properties(flutter_wrapper_plugin PROPERTIES 62 | CXX_VISIBILITY_PRESET hidden) 63 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 64 | target_include_directories(flutter_wrapper_plugin PUBLIC 65 | "${WRAPPER_ROOT}/include" 66 | ) 67 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 68 | 69 | # Wrapper sources needed for the runner. 70 | add_library(flutter_wrapper_app STATIC 71 | ${CPP_WRAPPER_SOURCES_CORE} 72 | ${CPP_WRAPPER_SOURCES_APP} 73 | ) 74 | apply_standard_settings(flutter_wrapper_app) 75 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 76 | target_include_directories(flutter_wrapper_app PUBLIC 77 | "${WRAPPER_ROOT}/include" 78 | ) 79 | add_dependencies(flutter_wrapper_app flutter_assemble) 80 | 81 | # === Flutter tool backend === 82 | # _phony_ is a non-existent file to force this command to run every time, 83 | # since currently there's no way to get a full input/output list from the 84 | # flutter tool. 85 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 86 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 87 | add_custom_command( 88 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 89 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 90 | ${CPP_WRAPPER_SOURCES_APP} 91 | ${PHONY_OUTPUT} 92 | COMMAND ${CMAKE_COMMAND} -E env 93 | ${FLUTTER_TOOL_ENVIRONMENT} 94 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 95 | windows-x64 $ 96 | VERBATIM 97 | ) 98 | add_custom_target(flutter_assemble DEPENDS 99 | "${FLUTTER_LIBRARY}" 100 | ${FLUTTER_LIBRARY_HEADERS} 101 | ${CPP_WRAPPER_SOURCES_CORE} 102 | ${CPP_WRAPPER_SOURCES_PLUGIN} 103 | ${CPP_WRAPPER_SOURCES_APP} 104 | ) 105 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | 11 | void RegisterPlugins(flutter::PluginRegistry* registry) { 12 | UrlLauncherWindowsRegisterWithRegistrar( 13 | registry->GetRegistrarForPlugin("UrlLauncherWindows")); 14 | } 15 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | url_launcher_windows 7 | ) 8 | 9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "functions.cpp" 15 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 16 | "Runner.rc" 17 | "runner.exe.manifest" 18 | ) 19 | 20 | # Apply the standard set of build settings. This can be removed for applications 21 | # that need different build settings. 22 | apply_standard_settings(${BINARY_NAME}) 23 | 24 | # Add preprocessor definitions for the build version. 25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") 26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") 27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") 28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") 29 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") 30 | 31 | # Disable Windows macros that collide with C++ standard library functions. 32 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 33 | 34 | # Add dependency libraries and include directories. Add any application-specific 35 | # dependencies here. 36 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 37 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 38 | 39 | # Run the Flutter tool portions of the build. This must not be removed. 40 | add_dependencies(${BINARY_NAME} flutter_assemble) 41 | -------------------------------------------------------------------------------- /windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) 64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0,0 67 | #endif 68 | 69 | #if defined(FLUTTER_VERSION) 70 | #define VERSION_AS_STRING FLUTTER_VERSION 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "kurotu" "\0" 93 | VALUE "FileDescription", "Tiny VCC" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "tiny_vcc" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 kurotu." "\0" 97 | VALUE "OriginalFilename", "tiny_vcc.exe" "\0" 98 | VALUE "ProductName", "Tiny VCC" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | #include "functions.h" 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | #include "flutter/generated_plugin_registrant.h" 15 | 16 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 17 | : project_(project) {} 18 | 19 | FlutterWindow::~FlutterWindow() {} 20 | 21 | bool FlutterWindow::OnCreate() { 22 | if (!Win32Window::OnCreate()) { 23 | return false; 24 | } 25 | 26 | auto hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); 27 | if (FAILED(hr)) { 28 | return false; 29 | } 30 | 31 | RECT frame = GetClientArea(); 32 | 33 | // The size here must match the window dimensions to avoid unnecessary surface 34 | // creation / destruction in the startup path. 35 | flutter_controller_ = std::make_unique( 36 | frame.right - frame.left, frame.bottom - frame.top, project_); 37 | // Ensure that basic setup of the controller was successful. 38 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 39 | return false; 40 | } 41 | RegisterPlugins(flutter_controller_->engine()); 42 | 43 | flutter::MethodChannel<> channel(flutter_controller_->engine()->messenger(), "com.github.kurotu.tiny_vcc/platform", &flutter::StandardMethodCodec::GetInstance()); 44 | channel.SetMethodCallHandler([](const flutter::MethodCall<>& call, std::unique_ptr> result) { 45 | if (call.method_name() == "moveToTrash") { 46 | const auto &args = call.arguments(); 47 | const auto &path = std::get(args[0]); 48 | const auto hr = tiny_vcc::MoveToTrash(path); 49 | if (FAILED(hr)) { 50 | result->Error("MoveToTrash", tiny_vcc::GetErrorMessage(hr)); 51 | } else { 52 | result->Success(); 53 | } 54 | } 55 | else { 56 | result->NotImplemented(); 57 | } 58 | }); 59 | 60 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 61 | return true; 62 | } 63 | 64 | void FlutterWindow::OnDestroy() { 65 | if (flutter_controller_) { 66 | flutter_controller_ = nullptr; 67 | } 68 | 69 | Win32Window::OnDestroy(); 70 | } 71 | 72 | LRESULT 73 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 74 | WPARAM const wparam, 75 | LPARAM const lparam) noexcept { 76 | // Give Flutter, including plugins, an opportunity to handle window messages. 77 | if (flutter_controller_) { 78 | std::optional result = 79 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 80 | lparam); 81 | if (result) { 82 | return *result; 83 | } 84 | } 85 | 86 | switch (message) { 87 | case WM_FONTCHANGE: 88 | flutter_controller_->engine()->ReloadSystemFonts(); 89 | break; 90 | } 91 | 92 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 93 | } 94 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /windows/runner/functions.cpp: -------------------------------------------------------------------------------- 1 | #include "functions.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace tiny_vcc { 10 | std::wstring utf8ToWString(const std::string& str); 11 | } 12 | 13 | HRESULT tiny_vcc::MoveToTrash(const std::string &path) { 14 | HRESULT hr; 15 | CComPtr pfo; 16 | 17 | const auto wPath = utf8ToWString(path); 18 | 19 | hr = CoCreateInstance(CLSID_FileOperation, NULL, CLSCTX_ALL, IID_PPV_ARGS(&pfo)); 20 | if (FAILED(hr)) 21 | { 22 | return hr; 23 | } 24 | 25 | hr = pfo->SetOperationFlags(FOF_ALLOWUNDO | FOF_NOCONFIRMATION | FOF_SILENT); 26 | if (FAILED(hr)) 27 | { 28 | return hr; 29 | } 30 | 31 | CComPtr psiItem; 32 | hr = SHCreateItemFromParsingName(wPath.c_str(), NULL, IID_PPV_ARGS(&psiItem)); 33 | if (FAILED(hr)) 34 | { 35 | return hr; 36 | } 37 | 38 | hr = pfo->DeleteItem(psiItem, NULL); 39 | if (FAILED(hr)) 40 | { 41 | return hr; 42 | } 43 | 44 | hr = pfo->PerformOperations(); 45 | if (FAILED(hr)) 46 | { 47 | return hr; 48 | } 49 | 50 | return hr; 51 | } 52 | 53 | std::string tiny_vcc::GetErrorMessage(HRESULT hr) 54 | { 55 | return std::system_category().message(hr); 56 | } 57 | 58 | std::wstring tiny_vcc::utf8ToWString(const std::string& str) { 59 | auto length = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), -1, NULL, 0); 60 | std::wstring wstr = L""; 61 | wstr.reserve(length + 1); 62 | MultiByteToWideChar(CP_UTF8, 0, str.c_str(), -1, wstr.data(), length + 1); 63 | return wstr; 64 | } 65 | -------------------------------------------------------------------------------- /windows/runner/functions.h: -------------------------------------------------------------------------------- 1 | #ifndef FUNCTIONS_H_ 2 | #define FUNCTIONS_H_ 3 | 4 | #include 5 | #include 6 | 7 | namespace tiny_vcc { 8 | HRESULT MoveToTrash(const std::string& path); 9 | std::string GetErrorMessage(HRESULT hr); 10 | } 11 | 12 | #endif // FUNCTIONS_H_ 13 | -------------------------------------------------------------------------------- /windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"Tiny VCC", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kurotu/tiny_vcc/7d938238d55fb34dfc83a2dc4b4ed3c192a79d4c/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | std::string utf8_string; 52 | if (target_length == 0 || target_length > utf8_string.max_size()) { 53 | return utf8_string; 54 | } 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates and shows a win32 window with |title| and position and size using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | --------------------------------------------------------------------------------