├── .github └── workflows │ └── main.yml ├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── assets └── disks_logo.png ├── build.yaml ├── example ├── .gitignore ├── .metadata ├── README.md ├── analysis_options.yaml ├── lib │ └── main.dart ├── linux │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ │ ├── CMakeLists.txt │ │ ├── generated_plugin_registrant.cc │ │ ├── generated_plugin_registrant.h │ │ └── generated_plugins.cmake │ ├── 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 │ │ ├── Info.plist │ │ ├── MainFlutterWindow.swift │ │ └── Release.entitlements ├── pubspec.lock ├── pubspec.yaml └── 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 │ ├── main.cpp │ ├── resource.h │ ├── resources │ └── app_icon.ico │ ├── runner.exe.manifest │ ├── utils.cpp │ ├── utils.h │ ├── win32_window.cpp │ └── win32_window.h ├── lib ├── disks_desktop.dart └── src │ ├── exceptions │ └── unsupported_platform_exception.dart │ ├── linux │ └── lsblk.dart │ ├── models │ └── disk.dart │ └── repositories │ └── disks_repository.dart ├── macos ├── Classes │ ├── DeviceManager.swift │ ├── Disk.swift │ └── DisksDesktopPlugin.swift └── disks_desktop.podspec ├── pubspec.yaml ├── renovate.json ├── test ├── linux │ ├── disks_test.dart │ └── lsblk.json ├── macos │ ├── disks_test.dart │ └── method_channel.json └── windows │ ├── disks_test.dart │ └── method_channel.json └── windows ├── .gitignore ├── CMakeLists.txt ├── disks_desktop_plugin.cpp └── include └── disks_desktop ├── disks_desktop_plugin.h ├── drivelist.cpp ├── drivelist.hpp ├── list.cpp └── list.hpp /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Flutter CI 2 | 3 | on: push 4 | 5 | jobs: 6 | tests-linux: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - uses: actions/checkout@v4 11 | - uses: subosito/flutter-action@v2 12 | with: 13 | channel: 'stable' 14 | flutter-version: '3.3.2' 15 | - name: Install dependencies 16 | run: flutter pub get 17 | - name: Generate support files 18 | run: flutter pub run build_runner build --delete-conflicting-outputs 19 | - name: Run Linux Tests 20 | run: flutter test test/linux/disks_test.dart 21 | 22 | tests-windows: 23 | runs-on: windows-latest 24 | 25 | steps: 26 | - uses: actions/checkout@v4 27 | - uses: subosito/flutter-action@v2 28 | with: 29 | channel: 'stable' 30 | flutter-version: '3.3.2' 31 | - name: Install dependencies 32 | run: flutter pub get 33 | - name: Run Windows Tests 34 | run: flutter test test/windows/disks_test.dart 35 | 36 | tests-macos: 37 | runs-on: macos-latest 38 | 39 | steps: 40 | - uses: actions/checkout@v4 41 | - uses: subosito/flutter-action@v2 42 | with: 43 | channel: 'stable' 44 | flutter-version: '3.3.2' 45 | architecture: x64 46 | - name: Install dependencies 47 | run: flutter pub get 48 | - name: Generate support files 49 | run: flutter pub run build_runner build --delete-conflicting-outputs 50 | - name: Run macOS Tests 51 | run: flutter test test/macos/disks_test.dart -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 25 | /pubspec.lock 26 | **/doc/api/ 27 | .dart_tool/ 28 | .packages 29 | build/ 30 | .fvm/ 31 | !.fvm/fvm_config.json 32 | 33 | *.g.dart 34 | *.gr.dart 35 | *.mocks.dart 36 | -------------------------------------------------------------------------------- /.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 and should not be manually edited. 5 | 6 | version: 7 | revision: 5f105a6ca7a5ac7b8bc9b241f4c2d86f4188cf5c 8 | channel: stable 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.1 2 | 3 | * First release 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2022 Angelo Cassano 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Disks Desktop 2 | 3 | Disks logo 4 | 5 | Disks Desktop is Flutter desktop library able to retrieve the installed devices information 6 | 7 | [![Pub](https://img.shields.io/pub/v/disks_desktop.svg)](https://pub.dev/packages/disks_desktop) 8 | ![Flutter CI](https://github.com/AngeloAvv/disks/workflows/Flutter%20CI/badge.svg) 9 | [![Star on GitHub](https://img.shields.io/github/stars/AngeloAvv/disks.svg?style=flat&logo=github&colorB=deeppink&label=stars)](https://github.com/AngeloAvv/disks) 10 | [![License: MIT](https://img.shields.io/badge/license-MIT-purple.svg)](https://opensource.org/licenses/MIT) 11 | 12 | If you want to support this project, 13 | 14 | [!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/angeloavv) 15 | 16 | 17 | With Disks Desktop you can get access to disks' information like: 18 | * block size 19 | * bus type 20 | * bus version 21 | * description 22 | * device name 23 | * device path 24 | * logical block size 25 | * available mountpoints 26 | * disk size 27 | * partition table type 28 | * is in error 29 | * is a card 30 | * is read only 31 | * is removable 32 | * is scsi 33 | * is system 34 | * is uas 35 | * is usb 36 | * is virtual 37 | * is raw 38 | 39 | ### Installation 40 | 41 | In general, put it under 42 | [dependencies](https://dart.dev/tools/pub/dependencies), 43 | in your [pubspec.yaml](https://dart.dev/tools/pub/pubspec): 44 | 45 | ```yaml 46 | dependencies: 47 | disks_desktop: ^1.0.1 48 | ``` 49 | 50 | You can install packages from the command line: 51 | 52 | ```terminal 53 | flutter pub get 54 | ``` 55 | 56 | or simply add it through the command line: 57 | 58 | ```terminal 59 | flutter pub add disks_desktop 60 | ``` 61 | 62 | ## Usage 63 | 64 | To get the list of the available drives with their details, simply create an instance of a Disk Repository, and then invoke the query getter. 65 | 66 | Example: 67 | ```dart 68 | final repository = DiskRepository(); 69 | final disks = await repository.query; 70 | ``` 71 | 72 | You can also use it with a FutureBuilder: 73 | ```dart 74 | FutureBuilder>( 75 | future: DisksRepository().query, 76 | builder: (context, snapshot) => [...] 77 | ), 78 | ``` 79 | 80 | ## License 81 | 82 | Disks Desktop is available under the MIT license. See the LICENSE file for more info. 83 | drivelist.cpp, drivelist.hpp, list.cpp and list.hpp are available under the Apache 2.0 license and belongs to balena.io 84 | 85 | ## Additional information 86 | Disks icon created by Freepik - Flaticon -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | linter: 4 | 5 | rules: 6 | 7 | analyzer: 8 | errors: 9 | todo: warning 10 | missing_return: error 11 | dead_code: error 12 | invalid_annotation_target: ignore 13 | exclude: 14 | - "**/*.g.dart" 15 | - "**/*.gr.dart" -------------------------------------------------------------------------------- /assets/disks_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngeloAvv/disks/d9610455092b3e9f816a2c8e666e54211eecad3f/assets/disks_logo.png -------------------------------------------------------------------------------- /build.yaml: -------------------------------------------------------------------------------- 1 | targets: 2 | $default: 3 | sources: 4 | exclude: 5 | - example/**.dart 6 | - windows/**.dart -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /example/.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 and should not be manually edited. 5 | 6 | version: 7 | revision: 5f105a6ca7a5ac7b8bc9b241f4c2d86f4188cf5c 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # disks_example 2 | 3 | Demonstrates how to use the disks plugin. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Angelo Cassano 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | import 'package:disks_desktop/disks_desktop.dart'; 27 | import 'package:flutter/material.dart'; 28 | import 'package:provider/provider.dart'; 29 | 30 | void main() { 31 | runApp(const MyApp()); 32 | } 33 | 34 | class MyApp extends StatelessWidget { 35 | const MyApp({Key? key}) : super(key: key); 36 | 37 | @override 38 | Widget build(BuildContext context) => Provider( 39 | create: (context) => DisksRepository(), 40 | child: MaterialApp( 41 | debugShowCheckedModeBanner: false, 42 | home: Scaffold( 43 | body: Builder( 44 | builder: (context) => FutureBuilder>( 45 | future: context.watch().query, 46 | builder: (context, snapshot) => snapshot.hasData 47 | ? _body(context, disks: snapshot.data!) 48 | : _loading(), 49 | ), 50 | ), 51 | ), 52 | ), 53 | ); 54 | 55 | Widget _loading() => const Center(child: CircularProgressIndicator()); 56 | 57 | Widget _body( 58 | BuildContext context, { 59 | required List disks, 60 | }) => 61 | Padding( 62 | padding: const EdgeInsets.all(32), 63 | child: Column( 64 | children: [ 65 | Text( 66 | 'Available disks', 67 | style: Theme.of(context) 68 | .textTheme 69 | .headline4 70 | ?.copyWith(color: Colors.black), 71 | ), 72 | _devices(disks), 73 | ], 74 | ), 75 | ); 76 | 77 | Widget _devices(List disks) => Expanded( 78 | child: ListView.separated( 79 | scrollDirection: Axis.horizontal, 80 | itemBuilder: (context, index) => _device(context, disk: disks[index]), 81 | separatorBuilder: (_, __) => const SizedBox(width: 32), 82 | itemCount: disks.length, 83 | ), 84 | ); 85 | 86 | Widget _device( 87 | BuildContext context, { 88 | required Disk disk, 89 | }) => 90 | Card( 91 | child: Padding( 92 | padding: const EdgeInsets.all(16.0), 93 | child: Column( 94 | children: [ 95 | const Icon(Icons.save, size: 128), 96 | Text( 97 | disk.device, 98 | style: Theme.of(context) 99 | .textTheme 100 | .titleMedium 101 | ?.copyWith(fontWeight: FontWeight.bold), 102 | ), 103 | const SizedBox(height: 8), 104 | Text('blockSize: ${disk.blockSize}'), 105 | Text('busType: ${disk.busType}'), 106 | Text('busVersion: ${disk.busVersion}'), 107 | Text('description: ${disk.description}'), 108 | Text('devicePath: ${disk.devicePath}'), 109 | Text('error: ${disk.error}'), 110 | Text('card: ${disk.card}'), 111 | Text('readOnly: ${disk.readOnly}'), 112 | Text('removable: ${disk.removable}'), 113 | Text('scsi: ${disk.scsi}'), 114 | Text('system: ${disk.system}'), 115 | Text('uas: ${disk.uas}'), 116 | Text('usb: ${disk.usb}'), 117 | Text('virtual: ${disk.virtual}'), 118 | Text('logicalBlockSize: ${disk.logicalBlockSize}'), 119 | Text('raw: ${disk.raw}'), 120 | Text('size: ${disk.size}'), 121 | Text('partitionTableType: ${disk.partitionTableType}'), 122 | Text( 123 | 'mountpoints: ${disk.mountpoints.map((mountpoint) => '${mountpoint.label} => ${mountpoint.path}').join(', ')}'), 124 | ], 125 | ), 126 | ), 127 | ); 128 | } 129 | -------------------------------------------------------------------------------- /example/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /example/linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | project(runner LANGUAGES CXX) 3 | 4 | set(BINARY_NAME "disks_desktop_example") 5 | set(APPLICATION_ID "com.example.disks_desktop") 6 | 7 | cmake_policy(SET CMP0063 NEW) 8 | 9 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 10 | 11 | # Root filesystem for cross-building. 12 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 13 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 14 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 15 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 16 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 17 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 18 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 19 | endif() 20 | 21 | # Configure build options. 22 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 23 | set(CMAKE_BUILD_TYPE "Debug" CACHE 24 | STRING "Flutter build mode" FORCE) 25 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 26 | "Debug" "Profile" "Release") 27 | endif() 28 | 29 | # Compilation settings that should be applied to most targets. 30 | function(APPLY_STANDARD_SETTINGS TARGET) 31 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 32 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 33 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 34 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 35 | endfunction() 36 | 37 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 38 | 39 | # Flutter library and tool build rules. 40 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 41 | 42 | # System-level dependencies. 43 | find_package(PkgConfig REQUIRED) 44 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 45 | 46 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 47 | 48 | # Application build 49 | add_executable(${BINARY_NAME} 50 | "main.cc" 51 | "my_application.cc" 52 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 53 | ) 54 | apply_standard_settings(${BINARY_NAME}) 55 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 56 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 57 | add_dependencies(${BINARY_NAME} flutter_assemble) 58 | # Only the install-generated bundle's copy of the executable will launch 59 | # correctly, since the resources must in the right relative locations. To avoid 60 | # people trying to run the unbundled copy, put it in a subdirectory instead of 61 | # the default top-level location. 62 | set_target_properties(${BINARY_NAME} 63 | PROPERTIES 64 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 65 | ) 66 | 67 | # Generated plugin build rules, which manage building the plugins and adding 68 | # them to the application. 69 | include(flutter/generated_plugins.cmake) 70 | 71 | 72 | # === Installation === 73 | # By default, "installing" just makes a relocatable bundle in the build 74 | # directory. 75 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 76 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 77 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 78 | endif() 79 | 80 | # Start with a clean build bundle directory every time. 81 | install(CODE " 82 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 83 | " COMPONENT Runtime) 84 | 85 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 86 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 87 | 88 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 89 | COMPONENT Runtime) 90 | 91 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 92 | COMPONENT Runtime) 93 | 94 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 95 | COMPONENT Runtime) 96 | 97 | if(PLUGIN_BUNDLED_LIBRARIES) 98 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 99 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 100 | COMPONENT Runtime) 101 | endif() 102 | 103 | # Fully re-copy the assets directory on each build to avoid having stale files 104 | # from a previous install. 105 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 106 | install(CODE " 107 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 108 | " COMPONENT Runtime) 109 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 110 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 111 | 112 | # Install the AOT library on non-Debug builds only. 113 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 114 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 115 | COMPONENT Runtime) 116 | endif() 117 | -------------------------------------------------------------------------------- /example/linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | 3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 4 | 5 | # Configuration provided via flutter tool. 6 | include(${EPHEMERAL_DIR}/generated_config.cmake) 7 | 8 | # TODO: Move the rest of this into files in ephemeral. See 9 | # https://github.com/flutter/flutter/issues/57146. 10 | 11 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 12 | # which isn't available in 3.10. 13 | function(list_prepend LIST_NAME PREFIX) 14 | set(NEW_LIST "") 15 | foreach(element ${${LIST_NAME}}) 16 | list(APPEND NEW_LIST "${PREFIX}${element}") 17 | endforeach(element) 18 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 19 | endfunction() 20 | 21 | # === Flutter Library === 22 | # System-level dependencies. 23 | find_package(PkgConfig REQUIRED) 24 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 25 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 26 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 27 | 28 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 29 | 30 | # Published to parent scope for install step. 31 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 32 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 33 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 34 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 35 | 36 | list(APPEND FLUTTER_LIBRARY_HEADERS 37 | "fl_basic_message_channel.h" 38 | "fl_binary_codec.h" 39 | "fl_binary_messenger.h" 40 | "fl_dart_project.h" 41 | "fl_engine.h" 42 | "fl_json_message_codec.h" 43 | "fl_json_method_codec.h" 44 | "fl_message_codec.h" 45 | "fl_method_call.h" 46 | "fl_method_channel.h" 47 | "fl_method_codec.h" 48 | "fl_method_response.h" 49 | "fl_plugin_registrar.h" 50 | "fl_plugin_registry.h" 51 | "fl_standard_message_codec.h" 52 | "fl_standard_method_codec.h" 53 | "fl_string_codec.h" 54 | "fl_value.h" 55 | "fl_view.h" 56 | "flutter_linux.h" 57 | ) 58 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 59 | add_library(flutter INTERFACE) 60 | target_include_directories(flutter INTERFACE 61 | "${EPHEMERAL_DIR}" 62 | ) 63 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 64 | target_link_libraries(flutter INTERFACE 65 | PkgConfig::GTK 66 | PkgConfig::GLIB 67 | PkgConfig::GIO 68 | ) 69 | add_dependencies(flutter flutter_assemble) 70 | 71 | # === Flutter tool backend === 72 | # _phony_ is a non-existent file to force this command to run every time, 73 | # since currently there's no way to get a full input/output list from the 74 | # flutter tool. 75 | add_custom_command( 76 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 77 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 78 | COMMAND ${CMAKE_COMMAND} -E env 79 | ${FLUTTER_TOOL_ENVIRONMENT} 80 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 81 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 82 | VERBATIM 83 | ) 84 | add_custom_target(flutter_assemble DEPENDS 85 | "${FLUTTER_LIBRARY}" 86 | ${FLUTTER_LIBRARY_HEADERS} 87 | ) 88 | -------------------------------------------------------------------------------- /example/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 | 10 | void fl_register_plugins(FlPluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "disks_desktop_example"); 44 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 46 | } else { 47 | gtk_window_set_title(window, "disks_desktop_example"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GObject::dispose. 85 | static void my_application_dispose(GObject* object) { 86 | MyApplication* self = MY_APPLICATION(object); 87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 89 | } 90 | 91 | static void my_application_class_init(MyApplicationClass* klass) { 92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 95 | } 96 | 97 | static void my_application_init(MyApplication* self) {} 98 | 99 | MyApplication* my_application_new() { 100 | return MY_APPLICATION(g_object_new(my_application_get_type(), 101 | "application-id", APPLICATION_ID, 102 | "flags", G_APPLICATION_NON_UNIQUE, 103 | nullptr)); 104 | } 105 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import disks_desktop 9 | 10 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 11 | DisksDesktopPlugin.register(with: registry.registrar(forPlugin: "DisksDesktopPlugin")) 12 | } 13 | -------------------------------------------------------------------------------- /example/macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.11' 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 | -------------------------------------------------------------------------------- /example/macos/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - disks_desktop (1.0.1): 3 | - FlutterMacOS 4 | - FlutterMacOS (1.0.0) 5 | 6 | DEPENDENCIES: 7 | - disks_desktop (from `Flutter/ephemeral/.symlinks/plugins/disks_desktop/macos`) 8 | - FlutterMacOS (from `Flutter/ephemeral`) 9 | 10 | EXTERNAL SOURCES: 11 | disks_desktop: 12 | :path: Flutter/ephemeral/.symlinks/plugins/disks_desktop/macos 13 | FlutterMacOS: 14 | :path: Flutter/ephemeral 15 | 16 | SPEC CHECKSUMS: 17 | disks_desktop: 038f4442f52155b25411eefa5eb598a1b938fdb5 18 | FlutterMacOS: ae6af50a8ea7d6103d888583d46bd8328a7e9811 19 | 20 | PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c 21 | 22 | COCOAPODS: 1.11.3 23 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 51; 7 | objects = { 8 | 9 | /* Begin PBXAggregateTarget section */ 10 | 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { 11 | isa = PBXAggregateTarget; 12 | buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; 13 | buildPhases = ( 14 | 33CC111E2044C6BF0003C045 /* ShellScript */, 15 | ); 16 | dependencies = ( 17 | ); 18 | name = "Flutter Assemble"; 19 | productName = FLX; 20 | }; 21 | /* End PBXAggregateTarget section */ 22 | 23 | /* Begin PBXBuildFile section */ 24 | 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; 25 | 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; 26 | 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 27 | 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 28 | 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; 29 | 3EA66DC195F5ACB8303F94A5 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 672B7C4D67FD406227FFE8CE /* Pods_Runner.framework */; }; 30 | /* End PBXBuildFile section */ 31 | 32 | /* Begin PBXContainerItemProxy section */ 33 | 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { 34 | isa = PBXContainerItemProxy; 35 | containerPortal = 33CC10E52044A3C60003C045 /* Project object */; 36 | proxyType = 1; 37 | remoteGlobalIDString = 33CC111A2044C6BA0003C045; 38 | remoteInfo = FLX; 39 | }; 40 | /* End PBXContainerItemProxy section */ 41 | 42 | /* Begin PBXCopyFilesBuildPhase section */ 43 | 33CC110E2044A8840003C045 /* Bundle Framework */ = { 44 | isa = PBXCopyFilesBuildPhase; 45 | buildActionMask = 2147483647; 46 | dstPath = ""; 47 | dstSubfolderSpec = 10; 48 | files = ( 49 | ); 50 | name = "Bundle Framework"; 51 | runOnlyForDeploymentPostprocessing = 0; 52 | }; 53 | /* End PBXCopyFilesBuildPhase section */ 54 | 55 | /* Begin PBXFileReference section */ 56 | 001F43D1901EB115D08F9230 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 57 | 13A4245F87F8C659FC479C42 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 58 | 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 59 | 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; 60 | 33CC10ED2044A3C60003C045 /* disks_desktop_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = disks_desktop_example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 61 | 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 62 | 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; 63 | 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 64 | 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; 65 | 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; 66 | 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; 67 | 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; 68 | 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; 69 | 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 70 | 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 71 | 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; 72 | 672B7C4D67FD406227FFE8CE /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 73 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; 74 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; 75 | E62914FA35994CF9955842F3 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 76 | /* End PBXFileReference section */ 77 | 78 | /* Begin PBXFrameworksBuildPhase section */ 79 | 33CC10EA2044A3C60003C045 /* Frameworks */ = { 80 | isa = PBXFrameworksBuildPhase; 81 | buildActionMask = 2147483647; 82 | files = ( 83 | 3EA66DC195F5ACB8303F94A5 /* Pods_Runner.framework in Frameworks */, 84 | ); 85 | runOnlyForDeploymentPostprocessing = 0; 86 | }; 87 | /* End PBXFrameworksBuildPhase section */ 88 | 89 | /* Begin PBXGroup section */ 90 | 33BA886A226E78AF003329D5 /* Configs */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | 33E5194F232828860026EE4D /* AppInfo.xcconfig */, 94 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 95 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 96 | 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, 97 | ); 98 | path = Configs; 99 | sourceTree = ""; 100 | }; 101 | 33CC10E42044A3C60003C045 = { 102 | isa = PBXGroup; 103 | children = ( 104 | 33FAB671232836740065AC1E /* Runner */, 105 | 33CEB47122A05771004F2AC0 /* Flutter */, 106 | 33CC10EE2044A3C60003C045 /* Products */, 107 | D73912EC22F37F3D000D13A0 /* Frameworks */, 108 | 8CA358E0C421AA3A6415338C /* Pods */, 109 | ); 110 | sourceTree = ""; 111 | }; 112 | 33CC10EE2044A3C60003C045 /* Products */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 33CC10ED2044A3C60003C045 /* disks_desktop_example.app */, 116 | ); 117 | name = Products; 118 | sourceTree = ""; 119 | }; 120 | 33CC11242044D66E0003C045 /* Resources */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 33CC10F22044A3C60003C045 /* Assets.xcassets */, 124 | 33CC10F42044A3C60003C045 /* MainMenu.xib */, 125 | 33CC10F72044A3C60003C045 /* Info.plist */, 126 | ); 127 | name = Resources; 128 | path = ..; 129 | sourceTree = ""; 130 | }; 131 | 33CEB47122A05771004F2AC0 /* Flutter */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, 135 | 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, 136 | 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, 137 | 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, 138 | ); 139 | path = Flutter; 140 | sourceTree = ""; 141 | }; 142 | 33FAB671232836740065AC1E /* Runner */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | 33CC10F02044A3C60003C045 /* AppDelegate.swift */, 146 | 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, 147 | 33E51913231747F40026EE4D /* DebugProfile.entitlements */, 148 | 33E51914231749380026EE4D /* Release.entitlements */, 149 | 33CC11242044D66E0003C045 /* Resources */, 150 | 33BA886A226E78AF003329D5 /* Configs */, 151 | ); 152 | path = Runner; 153 | sourceTree = ""; 154 | }; 155 | 8CA358E0C421AA3A6415338C /* Pods */ = { 156 | isa = PBXGroup; 157 | children = ( 158 | E62914FA35994CF9955842F3 /* Pods-Runner.debug.xcconfig */, 159 | 001F43D1901EB115D08F9230 /* Pods-Runner.release.xcconfig */, 160 | 13A4245F87F8C659FC479C42 /* Pods-Runner.profile.xcconfig */, 161 | ); 162 | name = Pods; 163 | path = Pods; 164 | sourceTree = ""; 165 | }; 166 | D73912EC22F37F3D000D13A0 /* Frameworks */ = { 167 | isa = PBXGroup; 168 | children = ( 169 | 672B7C4D67FD406227FFE8CE /* Pods_Runner.framework */, 170 | ); 171 | name = Frameworks; 172 | sourceTree = ""; 173 | }; 174 | /* End PBXGroup section */ 175 | 176 | /* Begin PBXNativeTarget section */ 177 | 33CC10EC2044A3C60003C045 /* Runner */ = { 178 | isa = PBXNativeTarget; 179 | buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; 180 | buildPhases = ( 181 | 8F4B0838FFB91B714975F532 /* [CP] Check Pods Manifest.lock */, 182 | 33CC10E92044A3C60003C045 /* Sources */, 183 | 33CC10EA2044A3C60003C045 /* Frameworks */, 184 | 33CC10EB2044A3C60003C045 /* Resources */, 185 | 33CC110E2044A8840003C045 /* Bundle Framework */, 186 | 3399D490228B24CF009A79C7 /* ShellScript */, 187 | 8300C247B5F0629D99AD0919 /* [CP] Embed Pods Frameworks */, 188 | ); 189 | buildRules = ( 190 | ); 191 | dependencies = ( 192 | 33CC11202044C79F0003C045 /* PBXTargetDependency */, 193 | ); 194 | name = Runner; 195 | productName = Runner; 196 | productReference = 33CC10ED2044A3C60003C045 /* disks_desktop_example.app */; 197 | productType = "com.apple.product-type.application"; 198 | }; 199 | /* End PBXNativeTarget section */ 200 | 201 | /* Begin PBXProject section */ 202 | 33CC10E52044A3C60003C045 /* Project object */ = { 203 | isa = PBXProject; 204 | attributes = { 205 | LastSwiftUpdateCheck = 0920; 206 | LastUpgradeCheck = 1300; 207 | ORGANIZATIONNAME = ""; 208 | TargetAttributes = { 209 | 33CC10EC2044A3C60003C045 = { 210 | CreatedOnToolsVersion = 9.2; 211 | LastSwiftMigration = 1100; 212 | ProvisioningStyle = Automatic; 213 | SystemCapabilities = { 214 | com.apple.Sandbox = { 215 | enabled = 1; 216 | }; 217 | }; 218 | }; 219 | 33CC111A2044C6BA0003C045 = { 220 | CreatedOnToolsVersion = 9.2; 221 | ProvisioningStyle = Manual; 222 | }; 223 | }; 224 | }; 225 | buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; 226 | compatibilityVersion = "Xcode 9.3"; 227 | developmentRegion = en; 228 | hasScannedForEncodings = 0; 229 | knownRegions = ( 230 | en, 231 | Base, 232 | ); 233 | mainGroup = 33CC10E42044A3C60003C045; 234 | productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; 235 | projectDirPath = ""; 236 | projectRoot = ""; 237 | targets = ( 238 | 33CC10EC2044A3C60003C045 /* Runner */, 239 | 33CC111A2044C6BA0003C045 /* Flutter Assemble */, 240 | ); 241 | }; 242 | /* End PBXProject section */ 243 | 244 | /* Begin PBXResourcesBuildPhase section */ 245 | 33CC10EB2044A3C60003C045 /* Resources */ = { 246 | isa = PBXResourcesBuildPhase; 247 | buildActionMask = 2147483647; 248 | files = ( 249 | 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, 250 | 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, 251 | ); 252 | runOnlyForDeploymentPostprocessing = 0; 253 | }; 254 | /* End PBXResourcesBuildPhase section */ 255 | 256 | /* Begin PBXShellScriptBuildPhase section */ 257 | 3399D490228B24CF009A79C7 /* ShellScript */ = { 258 | isa = PBXShellScriptBuildPhase; 259 | buildActionMask = 2147483647; 260 | files = ( 261 | ); 262 | inputFileListPaths = ( 263 | ); 264 | inputPaths = ( 265 | ); 266 | outputFileListPaths = ( 267 | ); 268 | outputPaths = ( 269 | ); 270 | runOnlyForDeploymentPostprocessing = 0; 271 | shellPath = /bin/sh; 272 | shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; 273 | }; 274 | 33CC111E2044C6BF0003C045 /* ShellScript */ = { 275 | isa = PBXShellScriptBuildPhase; 276 | buildActionMask = 2147483647; 277 | files = ( 278 | ); 279 | inputFileListPaths = ( 280 | Flutter/ephemeral/FlutterInputs.xcfilelist, 281 | ); 282 | inputPaths = ( 283 | Flutter/ephemeral/tripwire, 284 | ); 285 | outputFileListPaths = ( 286 | Flutter/ephemeral/FlutterOutputs.xcfilelist, 287 | ); 288 | outputPaths = ( 289 | ); 290 | runOnlyForDeploymentPostprocessing = 0; 291 | shellPath = /bin/sh; 292 | shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; 293 | }; 294 | 8300C247B5F0629D99AD0919 /* [CP] Embed Pods Frameworks */ = { 295 | isa = PBXShellScriptBuildPhase; 296 | buildActionMask = 2147483647; 297 | files = ( 298 | ); 299 | inputFileListPaths = ( 300 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", 301 | ); 302 | name = "[CP] Embed Pods Frameworks"; 303 | outputFileListPaths = ( 304 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", 305 | ); 306 | runOnlyForDeploymentPostprocessing = 0; 307 | shellPath = /bin/sh; 308 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 309 | showEnvVarsInLog = 0; 310 | }; 311 | 8F4B0838FFB91B714975F532 /* [CP] Check Pods Manifest.lock */ = { 312 | isa = PBXShellScriptBuildPhase; 313 | buildActionMask = 2147483647; 314 | files = ( 315 | ); 316 | inputFileListPaths = ( 317 | ); 318 | inputPaths = ( 319 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 320 | "${PODS_ROOT}/Manifest.lock", 321 | ); 322 | name = "[CP] Check Pods Manifest.lock"; 323 | outputFileListPaths = ( 324 | ); 325 | outputPaths = ( 326 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 327 | ); 328 | runOnlyForDeploymentPostprocessing = 0; 329 | shellPath = /bin/sh; 330 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 331 | showEnvVarsInLog = 0; 332 | }; 333 | /* End PBXShellScriptBuildPhase section */ 334 | 335 | /* Begin PBXSourcesBuildPhase section */ 336 | 33CC10E92044A3C60003C045 /* Sources */ = { 337 | isa = PBXSourcesBuildPhase; 338 | buildActionMask = 2147483647; 339 | files = ( 340 | 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, 341 | 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, 342 | 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, 343 | ); 344 | runOnlyForDeploymentPostprocessing = 0; 345 | }; 346 | /* End PBXSourcesBuildPhase section */ 347 | 348 | /* Begin PBXTargetDependency section */ 349 | 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { 350 | isa = PBXTargetDependency; 351 | target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; 352 | targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; 353 | }; 354 | /* End PBXTargetDependency section */ 355 | 356 | /* Begin PBXVariantGroup section */ 357 | 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { 358 | isa = PBXVariantGroup; 359 | children = ( 360 | 33CC10F52044A3C60003C045 /* Base */, 361 | ); 362 | name = MainMenu.xib; 363 | path = Runner; 364 | sourceTree = ""; 365 | }; 366 | /* End PBXVariantGroup section */ 367 | 368 | /* Begin XCBuildConfiguration section */ 369 | 338D0CE9231458BD00FA5F75 /* Profile */ = { 370 | isa = XCBuildConfiguration; 371 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 372 | buildSettings = { 373 | ALWAYS_SEARCH_USER_PATHS = NO; 374 | CLANG_ANALYZER_NONNULL = YES; 375 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 376 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 377 | CLANG_CXX_LIBRARY = "libc++"; 378 | CLANG_ENABLE_MODULES = YES; 379 | CLANG_ENABLE_OBJC_ARC = YES; 380 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 381 | CLANG_WARN_BOOL_CONVERSION = YES; 382 | CLANG_WARN_CONSTANT_CONVERSION = YES; 383 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 384 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 385 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 386 | CLANG_WARN_EMPTY_BODY = YES; 387 | CLANG_WARN_ENUM_CONVERSION = YES; 388 | CLANG_WARN_INFINITE_RECURSION = YES; 389 | CLANG_WARN_INT_CONVERSION = YES; 390 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 391 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 392 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 393 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 394 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 395 | CODE_SIGN_IDENTITY = "-"; 396 | COPY_PHASE_STRIP = NO; 397 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 398 | ENABLE_NS_ASSERTIONS = NO; 399 | ENABLE_STRICT_OBJC_MSGSEND = YES; 400 | GCC_C_LANGUAGE_STANDARD = gnu11; 401 | GCC_NO_COMMON_BLOCKS = YES; 402 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 403 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 404 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 405 | GCC_WARN_UNUSED_FUNCTION = YES; 406 | GCC_WARN_UNUSED_VARIABLE = YES; 407 | MACOSX_DEPLOYMENT_TARGET = 10.11; 408 | MTL_ENABLE_DEBUG_INFO = NO; 409 | SDKROOT = macosx; 410 | SWIFT_COMPILATION_MODE = wholemodule; 411 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 412 | }; 413 | name = Profile; 414 | }; 415 | 338D0CEA231458BD00FA5F75 /* Profile */ = { 416 | isa = XCBuildConfiguration; 417 | baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; 418 | buildSettings = { 419 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 420 | CLANG_ENABLE_MODULES = YES; 421 | CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; 422 | CODE_SIGN_STYLE = Automatic; 423 | COMBINE_HIDPI_IMAGES = YES; 424 | INFOPLIST_FILE = Runner/Info.plist; 425 | LD_RUNPATH_SEARCH_PATHS = ( 426 | "$(inherited)", 427 | "@executable_path/../Frameworks", 428 | ); 429 | PROVISIONING_PROFILE_SPECIFIER = ""; 430 | SWIFT_VERSION = 5.0; 431 | }; 432 | name = Profile; 433 | }; 434 | 338D0CEB231458BD00FA5F75 /* Profile */ = { 435 | isa = XCBuildConfiguration; 436 | buildSettings = { 437 | CODE_SIGN_STYLE = Manual; 438 | PRODUCT_NAME = "$(TARGET_NAME)"; 439 | }; 440 | name = Profile; 441 | }; 442 | 33CC10F92044A3C60003C045 /* Debug */ = { 443 | isa = XCBuildConfiguration; 444 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 445 | buildSettings = { 446 | ALWAYS_SEARCH_USER_PATHS = NO; 447 | CLANG_ANALYZER_NONNULL = YES; 448 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 449 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 450 | CLANG_CXX_LIBRARY = "libc++"; 451 | CLANG_ENABLE_MODULES = YES; 452 | CLANG_ENABLE_OBJC_ARC = YES; 453 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 454 | CLANG_WARN_BOOL_CONVERSION = YES; 455 | CLANG_WARN_CONSTANT_CONVERSION = YES; 456 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 457 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 458 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 459 | CLANG_WARN_EMPTY_BODY = YES; 460 | CLANG_WARN_ENUM_CONVERSION = YES; 461 | CLANG_WARN_INFINITE_RECURSION = YES; 462 | CLANG_WARN_INT_CONVERSION = YES; 463 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 464 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 465 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 466 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 467 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 468 | CODE_SIGN_IDENTITY = "-"; 469 | COPY_PHASE_STRIP = NO; 470 | DEBUG_INFORMATION_FORMAT = dwarf; 471 | ENABLE_STRICT_OBJC_MSGSEND = YES; 472 | ENABLE_TESTABILITY = YES; 473 | GCC_C_LANGUAGE_STANDARD = gnu11; 474 | GCC_DYNAMIC_NO_PIC = NO; 475 | GCC_NO_COMMON_BLOCKS = YES; 476 | GCC_OPTIMIZATION_LEVEL = 0; 477 | GCC_PREPROCESSOR_DEFINITIONS = ( 478 | "DEBUG=1", 479 | "$(inherited)", 480 | ); 481 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 482 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 483 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 484 | GCC_WARN_UNUSED_FUNCTION = YES; 485 | GCC_WARN_UNUSED_VARIABLE = YES; 486 | MACOSX_DEPLOYMENT_TARGET = 10.11; 487 | MTL_ENABLE_DEBUG_INFO = YES; 488 | ONLY_ACTIVE_ARCH = YES; 489 | SDKROOT = macosx; 490 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 491 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 492 | }; 493 | name = Debug; 494 | }; 495 | 33CC10FA2044A3C60003C045 /* Release */ = { 496 | isa = XCBuildConfiguration; 497 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 498 | buildSettings = { 499 | ALWAYS_SEARCH_USER_PATHS = NO; 500 | CLANG_ANALYZER_NONNULL = YES; 501 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 502 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 503 | CLANG_CXX_LIBRARY = "libc++"; 504 | CLANG_ENABLE_MODULES = YES; 505 | CLANG_ENABLE_OBJC_ARC = YES; 506 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 507 | CLANG_WARN_BOOL_CONVERSION = YES; 508 | CLANG_WARN_CONSTANT_CONVERSION = YES; 509 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 510 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 511 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 512 | CLANG_WARN_EMPTY_BODY = YES; 513 | CLANG_WARN_ENUM_CONVERSION = YES; 514 | CLANG_WARN_INFINITE_RECURSION = YES; 515 | CLANG_WARN_INT_CONVERSION = YES; 516 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 517 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 518 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 519 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 520 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 521 | CODE_SIGN_IDENTITY = "-"; 522 | COPY_PHASE_STRIP = NO; 523 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 524 | ENABLE_NS_ASSERTIONS = NO; 525 | ENABLE_STRICT_OBJC_MSGSEND = YES; 526 | GCC_C_LANGUAGE_STANDARD = gnu11; 527 | GCC_NO_COMMON_BLOCKS = YES; 528 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 529 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 530 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 531 | GCC_WARN_UNUSED_FUNCTION = YES; 532 | GCC_WARN_UNUSED_VARIABLE = YES; 533 | MACOSX_DEPLOYMENT_TARGET = 10.11; 534 | MTL_ENABLE_DEBUG_INFO = NO; 535 | SDKROOT = macosx; 536 | SWIFT_COMPILATION_MODE = wholemodule; 537 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 538 | }; 539 | name = Release; 540 | }; 541 | 33CC10FC2044A3C60003C045 /* Debug */ = { 542 | isa = XCBuildConfiguration; 543 | baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; 544 | buildSettings = { 545 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 546 | CLANG_ENABLE_MODULES = YES; 547 | CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; 548 | CODE_SIGN_STYLE = Automatic; 549 | COMBINE_HIDPI_IMAGES = YES; 550 | INFOPLIST_FILE = Runner/Info.plist; 551 | LD_RUNPATH_SEARCH_PATHS = ( 552 | "$(inherited)", 553 | "@executable_path/../Frameworks", 554 | ); 555 | PROVISIONING_PROFILE_SPECIFIER = ""; 556 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 557 | SWIFT_VERSION = 5.0; 558 | }; 559 | name = Debug; 560 | }; 561 | 33CC10FD2044A3C60003C045 /* Release */ = { 562 | isa = XCBuildConfiguration; 563 | baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; 564 | buildSettings = { 565 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 566 | CLANG_ENABLE_MODULES = YES; 567 | CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; 568 | CODE_SIGN_STYLE = Automatic; 569 | COMBINE_HIDPI_IMAGES = YES; 570 | INFOPLIST_FILE = Runner/Info.plist; 571 | LD_RUNPATH_SEARCH_PATHS = ( 572 | "$(inherited)", 573 | "@executable_path/../Frameworks", 574 | ); 575 | PROVISIONING_PROFILE_SPECIFIER = ""; 576 | SWIFT_VERSION = 5.0; 577 | }; 578 | name = Release; 579 | }; 580 | 33CC111C2044C6BA0003C045 /* Debug */ = { 581 | isa = XCBuildConfiguration; 582 | buildSettings = { 583 | CODE_SIGN_STYLE = Manual; 584 | PRODUCT_NAME = "$(TARGET_NAME)"; 585 | }; 586 | name = Debug; 587 | }; 588 | 33CC111D2044C6BA0003C045 /* Release */ = { 589 | isa = XCBuildConfiguration; 590 | buildSettings = { 591 | CODE_SIGN_STYLE = Automatic; 592 | PRODUCT_NAME = "$(TARGET_NAME)"; 593 | }; 594 | name = Release; 595 | }; 596 | /* End XCBuildConfiguration section */ 597 | 598 | /* Begin XCConfigurationList section */ 599 | 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { 600 | isa = XCConfigurationList; 601 | buildConfigurations = ( 602 | 33CC10F92044A3C60003C045 /* Debug */, 603 | 33CC10FA2044A3C60003C045 /* Release */, 604 | 338D0CE9231458BD00FA5F75 /* Profile */, 605 | ); 606 | defaultConfigurationIsVisible = 0; 607 | defaultConfigurationName = Release; 608 | }; 609 | 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { 610 | isa = XCConfigurationList; 611 | buildConfigurations = ( 612 | 33CC10FC2044A3C60003C045 /* Debug */, 613 | 33CC10FD2044A3C60003C045 /* Release */, 614 | 338D0CEA231458BD00FA5F75 /* Profile */, 615 | ); 616 | defaultConfigurationIsVisible = 0; 617 | defaultConfigurationName = Release; 618 | }; 619 | 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { 620 | isa = XCConfigurationList; 621 | buildConfigurations = ( 622 | 33CC111C2044C6BA0003C045 /* Debug */, 623 | 33CC111D2044C6BA0003C045 /* Release */, 624 | 338D0CEB231458BD00FA5F75 /* Profile */, 625 | ); 626 | defaultConfigurationIsVisible = 0; 627 | defaultConfigurationName = Release; 628 | }; 629 | /* End XCConfigurationList section */ 630 | }; 631 | rootObject = 33CC10E52044A3C60003C045 /* Project object */; 632 | } 633 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngeloAvv/disks/d9610455092b3e9f816a2c8e666e54211eecad3f/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngeloAvv/disks/d9610455092b3e9f816a2c8e666e54211eecad3f/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngeloAvv/disks/d9610455092b3e9f816a2c8e666e54211eecad3f/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngeloAvv/disks/d9610455092b3e9f816a2c8e666e54211eecad3f/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngeloAvv/disks/d9610455092b3e9f816a2c8e666e54211eecad3f/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngeloAvv/disks/d9610455092b3e9f816a2c8e666e54211eecad3f/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngeloAvv/disks/d9610455092b3e9f816a2c8e666e54211eecad3f/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /example/macos/Runner/Base.lproj/MainMenu.xib: -------------------------------------------------------------------------------- 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 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | -------------------------------------------------------------------------------- /example/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 = disks_desktop_example 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.disksDesktopExample 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.9.0" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.1.0" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.2.1" 25 | clock: 26 | dependency: transitive 27 | description: 28 | name: clock 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.1.1" 32 | collection: 33 | dependency: transitive 34 | description: 35 | name: collection 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.16.0" 39 | cupertino_icons: 40 | dependency: "direct main" 41 | description: 42 | name: cupertino_icons 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.0.5" 46 | disks_desktop: 47 | dependency: "direct main" 48 | description: 49 | path: ".." 50 | relative: true 51 | source: path 52 | version: "1.0.1" 53 | equatable: 54 | dependency: transitive 55 | description: 56 | name: equatable 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "2.0.5" 60 | fake_async: 61 | dependency: transitive 62 | description: 63 | name: fake_async 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "1.3.1" 67 | flutter: 68 | dependency: "direct main" 69 | description: flutter 70 | source: sdk 71 | version: "0.0.0" 72 | flutter_lints: 73 | dependency: "direct dev" 74 | description: 75 | name: flutter_lints 76 | url: "https://pub.dartlang.org" 77 | source: hosted 78 | version: "1.0.4" 79 | flutter_test: 80 | dependency: "direct dev" 81 | description: flutter 82 | source: sdk 83 | version: "0.0.0" 84 | lints: 85 | dependency: transitive 86 | description: 87 | name: lints 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "1.0.1" 91 | matcher: 92 | dependency: transitive 93 | description: 94 | name: matcher 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "0.12.12" 98 | material_color_utilities: 99 | dependency: transitive 100 | description: 101 | name: material_color_utilities 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "0.1.5" 105 | meta: 106 | dependency: transitive 107 | description: 108 | name: meta 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "1.8.0" 112 | nested: 113 | dependency: transitive 114 | description: 115 | name: nested 116 | url: "https://pub.dartlang.org" 117 | source: hosted 118 | version: "1.0.0" 119 | path: 120 | dependency: transitive 121 | description: 122 | name: path 123 | url: "https://pub.dartlang.org" 124 | source: hosted 125 | version: "1.8.2" 126 | provider: 127 | dependency: "direct main" 128 | description: 129 | name: provider 130 | url: "https://pub.dartlang.org" 131 | source: hosted 132 | version: "6.0.3" 133 | sky_engine: 134 | dependency: transitive 135 | description: flutter 136 | source: sdk 137 | version: "0.0.99" 138 | source_span: 139 | dependency: transitive 140 | description: 141 | name: source_span 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "1.9.0" 145 | stack_trace: 146 | dependency: transitive 147 | description: 148 | name: stack_trace 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "1.10.0" 152 | stream_channel: 153 | dependency: transitive 154 | description: 155 | name: stream_channel 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "2.1.0" 159 | string_scanner: 160 | dependency: transitive 161 | description: 162 | name: string_scanner 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "1.1.1" 166 | term_glyph: 167 | dependency: transitive 168 | description: 169 | name: term_glyph 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "1.2.1" 173 | test_api: 174 | dependency: transitive 175 | description: 176 | name: test_api 177 | url: "https://pub.dartlang.org" 178 | source: hosted 179 | version: "0.4.12" 180 | vector_math: 181 | dependency: transitive 182 | description: 183 | name: vector_math 184 | url: "https://pub.dartlang.org" 185 | source: hosted 186 | version: "2.1.2" 187 | sdks: 188 | dart: ">=2.17.6 <3.0.0" 189 | flutter: ">=3.3.2" 190 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: disks_example 2 | description: Demonstrates how to use the disks plugin. 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 | environment: 9 | sdk: ">=2.17.6 <3.0.0" 10 | 11 | # Dependencies specify other packages that your package needs in order to work. 12 | # To automatically upgrade your package dependencies to the latest versions 13 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 14 | # dependencies can be manually updated by changing the version numbers below to 15 | # the latest version available on pub.dev. To see which dependencies have newer 16 | # versions available, run `flutter pub outdated`. 17 | dependencies: 18 | flutter: 19 | sdk: flutter 20 | 21 | disks_desktop: 22 | # When depending on this package from a real application you should use: 23 | # disks: ^x.y.z 24 | # See https://dart.dev/tools/pub/dependencies#version-constraints 25 | # The example app is bundled with the plugin so we use a path dependency on 26 | # the parent directory to use the current plugin's version. 27 | path: ../ 28 | 29 | # The following adds the Cupertino Icons font to your application. 30 | # Use with the CupertinoIcons class for iOS style icons. 31 | cupertino_icons: ^1.0.5 32 | provider: ^6.0.3 33 | 34 | dev_dependencies: 35 | flutter_test: 36 | sdk: flutter 37 | 38 | # The "flutter_lints" package below contains a set of recommended lints to 39 | # encourage good coding practices. The lint set provided by the package is 40 | # activated in the `analysis_options.yaml` file located at the root of your 41 | # package. See that file for information about deactivating specific lint 42 | # rules and activating additional ones. 43 | flutter_lints: ^1.0.0 44 | 45 | # For information on the generic Dart part of this file, see the 46 | # following page: https://dart.dev/tools/pub/pubspec 47 | 48 | # The following section is specific to Flutter. 49 | flutter: 50 | 51 | # The following line ensures that the Material Icons font is 52 | # included with your application, so that you can use the icons in 53 | # the material Icons class. 54 | uses-material-design: true 55 | 56 | # To add assets to your application, add an assets section, like this: 57 | # assets: 58 | # - images/a_dot_burr.jpeg 59 | # - images/a_dot_ham.jpeg 60 | 61 | # An image asset can refer to one or more resolution-specific "variants", see 62 | # https://flutter.dev/assets-and-images/#resolution-aware. 63 | 64 | # For details regarding adding assets from package dependencies, see 65 | # https://flutter.dev/assets-and-images/#from-packages 66 | 67 | # To add custom fonts to your application, add a fonts section here, 68 | # in this "flutter" section. Each entry in this list should have a 69 | # "family" key with the font family name, and a "fonts" key with a 70 | # list giving the asset and other descriptors for the font. For 71 | # example: 72 | # fonts: 73 | # - family: Schyler 74 | # fonts: 75 | # - asset: fonts/Schyler-Regular.ttf 76 | # - asset: fonts/Schyler-Italic.ttf 77 | # style: italic 78 | # - family: Trajan Pro 79 | # fonts: 80 | # - asset: fonts/TrajanPro.ttf 81 | # - asset: fonts/TrajanPro_Bold.ttf 82 | # weight: 700 83 | # 84 | # For details regarding fonts from package dependencies, 85 | # see https://flutter.dev/custom-fonts/#from-packages 86 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(disks_desktop_example LANGUAGES CXX) 3 | 4 | set(BINARY_NAME "disks_desktop_example") 5 | 6 | cmake_policy(SET CMP0063 NEW) 7 | 8 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 9 | 10 | # Configure build options. 11 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 12 | if(IS_MULTICONFIG) 13 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 14 | CACHE STRING "" FORCE) 15 | else() 16 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 17 | set(CMAKE_BUILD_TYPE "Debug" CACHE 18 | STRING "Flutter build mode" FORCE) 19 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 20 | "Debug" "Profile" "Release") 21 | endif() 22 | endif() 23 | 24 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 25 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 26 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 27 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 28 | 29 | # Use Unicode for all projects. 30 | add_definitions(-DUNICODE -D_UNICODE) 31 | 32 | # Compilation settings that should be applied to most targets. 33 | function(APPLY_STANDARD_SETTINGS TARGET) 34 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 35 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 36 | target_compile_options(${TARGET} PRIVATE /EHsc) 37 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 38 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 39 | endfunction() 40 | 41 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 42 | 43 | # Flutter library and tool build rules. 44 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 45 | 46 | # Application build 47 | add_subdirectory("runner") 48 | 49 | # Generated plugin build rules, which manage building the plugins and adding 50 | # them to the application. 51 | include(flutter/generated_plugins.cmake) 52 | 53 | 54 | # === Installation === 55 | # Support files are copied into place next to the executable, so that it can 56 | # run in place. This is done instead of making a separate bundle (as on Linux) 57 | # so that building and running from within Visual Studio will work. 58 | set(BUILD_BUNDLE_DIR "$") 59 | # Make the "install" step default, as it's required to run. 60 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 61 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 62 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 63 | endif() 64 | 65 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 66 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 67 | 68 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 69 | COMPONENT Runtime) 70 | 71 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 72 | COMPONENT Runtime) 73 | 74 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 75 | COMPONENT Runtime) 76 | 77 | if(PLUGIN_BUNDLED_LIBRARIES) 78 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 79 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 80 | COMPONENT Runtime) 81 | endif() 82 | 83 | # Fully re-copy the assets directory on each build to avoid having stale files 84 | # from a previous install. 85 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 86 | install(CODE " 87 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 88 | " COMPONENT Runtime) 89 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 90 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 91 | 92 | # Install the AOT library on non-Debug builds only. 93 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 94 | CONFIGURATIONS Profile;Release 95 | COMPONENT Runtime) 96 | -------------------------------------------------------------------------------- /example/windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | 3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 4 | 5 | # Configuration provided via flutter tool. 6 | include(${EPHEMERAL_DIR}/generated_config.cmake) 7 | 8 | # TODO: Move the rest of this into files in ephemeral. See 9 | # https://github.com/flutter/flutter/issues/57146. 10 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 11 | 12 | # === Flutter Library === 13 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 14 | 15 | # Published to parent scope for install step. 16 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 17 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 18 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 19 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 20 | 21 | list(APPEND FLUTTER_LIBRARY_HEADERS 22 | "flutter_export.h" 23 | "flutter_windows.h" 24 | "flutter_messenger.h" 25 | "flutter_plugin_registrar.h" 26 | "flutter_texture_registrar.h" 27 | ) 28 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 29 | add_library(flutter INTERFACE) 30 | target_include_directories(flutter INTERFACE 31 | "${EPHEMERAL_DIR}" 32 | ) 33 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 34 | add_dependencies(flutter flutter_assemble) 35 | 36 | # === Wrapper === 37 | list(APPEND CPP_WRAPPER_SOURCES_CORE 38 | "core_implementations.cc" 39 | "standard_codec.cc" 40 | ) 41 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 42 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 43 | "plugin_registrar.cc" 44 | ) 45 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 46 | list(APPEND CPP_WRAPPER_SOURCES_APP 47 | "flutter_engine.cc" 48 | "flutter_view_controller.cc" 49 | ) 50 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 51 | 52 | # Wrapper sources needed for a plugin. 53 | add_library(flutter_wrapper_plugin STATIC 54 | ${CPP_WRAPPER_SOURCES_CORE} 55 | ${CPP_WRAPPER_SOURCES_PLUGIN} 56 | ) 57 | apply_standard_settings(flutter_wrapper_plugin) 58 | set_target_properties(flutter_wrapper_plugin PROPERTIES 59 | POSITION_INDEPENDENT_CODE ON) 60 | set_target_properties(flutter_wrapper_plugin PROPERTIES 61 | CXX_VISIBILITY_PRESET hidden) 62 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 63 | target_include_directories(flutter_wrapper_plugin PUBLIC 64 | "${WRAPPER_ROOT}/include" 65 | ) 66 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 67 | 68 | # Wrapper sources needed for the runner. 69 | add_library(flutter_wrapper_app STATIC 70 | ${CPP_WRAPPER_SOURCES_CORE} 71 | ${CPP_WRAPPER_SOURCES_APP} 72 | ) 73 | apply_standard_settings(flutter_wrapper_app) 74 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 75 | target_include_directories(flutter_wrapper_app PUBLIC 76 | "${WRAPPER_ROOT}/include" 77 | ) 78 | add_dependencies(flutter_wrapper_app flutter_assemble) 79 | 80 | # === Flutter tool backend === 81 | # _phony_ is a non-existent file to force this command to run every time, 82 | # since currently there's no way to get a full input/output list from the 83 | # flutter tool. 84 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 85 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 86 | add_custom_command( 87 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 88 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 89 | ${CPP_WRAPPER_SOURCES_APP} 90 | ${PHONY_OUTPUT} 91 | COMMAND ${CMAKE_COMMAND} -E env 92 | ${FLUTTER_TOOL_ENVIRONMENT} 93 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 94 | windows-x64 $ 95 | VERBATIM 96 | ) 97 | add_custom_target(flutter_assemble DEPENDS 98 | "${FLUTTER_LIBRARY}" 99 | ${FLUTTER_LIBRARY_HEADERS} 100 | ${CPP_WRAPPER_SOURCES_CORE} 101 | ${CPP_WRAPPER_SOURCES_PLUGIN} 102 | ${CPP_WRAPPER_SOURCES_APP} 103 | ) 104 | -------------------------------------------------------------------------------- /example/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 | DisksDesktopPluginRegisterWithRegistrar( 13 | registry->GetRegistrarForPlugin("DisksDesktopPlugin")); 14 | } 15 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | disks_desktop 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 | -------------------------------------------------------------------------------- /example/windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | add_executable(${BINARY_NAME} WIN32 5 | "flutter_window.cpp" 6 | "main.cpp" 7 | "utils.cpp" 8 | "win32_window.cpp" 9 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 10 | "Runner.rc" 11 | "runner.exe.manifest" 12 | ) 13 | apply_standard_settings(${BINARY_NAME}) 14 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 15 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 16 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 17 | add_dependencies(${BINARY_NAME} flutter_assemble) 18 | -------------------------------------------------------------------------------- /example/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 | #ifdef FLUTTER_BUILD_NUMBER 64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0 67 | #endif 68 | 69 | #ifdef FLUTTER_BUILD_NAME 70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME 71 | #else 72 | #define VERSION_AS_STRING "1.0.1" 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", "Angelo Cassano" "\0" 93 | VALUE "FileDescription", "disks_desktop_example" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "disks_desktop_example" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 Angelo Cassano. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "disks_desktop_example.exe" "\0" 98 | VALUE "ProductName", "disks_desktop_example" "\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 | -------------------------------------------------------------------------------- /example/windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/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"disks_desktop_example", 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 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngeloAvv/disks/d9610455092b3e9f816a2c8e666e54211eecad3f/example/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/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 | if (target_length == 0) { 52 | return std::string(); 53 | } 54 | std::string utf8_string; 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 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/windows/runner/win32_window.cpp: -------------------------------------------------------------------------------- 1 | #include "win32_window.h" 2 | 3 | #include 4 | 5 | #include "resource.h" 6 | 7 | namespace { 8 | 9 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; 10 | 11 | // The number of Win32Window objects that currently exist. 12 | static int g_active_window_count = 0; 13 | 14 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); 15 | 16 | // Scale helper to convert logical scaler values to physical using passed in 17 | // scale factor 18 | int Scale(int source, double scale_factor) { 19 | return static_cast(source * scale_factor); 20 | } 21 | 22 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. 23 | // This API is only needed for PerMonitor V1 awareness mode. 24 | void EnableFullDpiSupportIfAvailable(HWND hwnd) { 25 | HMODULE user32_module = LoadLibraryA("User32.dll"); 26 | if (!user32_module) { 27 | return; 28 | } 29 | auto enable_non_client_dpi_scaling = 30 | reinterpret_cast( 31 | GetProcAddress(user32_module, "EnableNonClientDpiScaling")); 32 | if (enable_non_client_dpi_scaling != nullptr) { 33 | enable_non_client_dpi_scaling(hwnd); 34 | FreeLibrary(user32_module); 35 | } 36 | } 37 | 38 | } // namespace 39 | 40 | // Manages the Win32Window's window class registration. 41 | class WindowClassRegistrar { 42 | public: 43 | ~WindowClassRegistrar() = default; 44 | 45 | // Returns the singleton registar instance. 46 | static WindowClassRegistrar* GetInstance() { 47 | if (!instance_) { 48 | instance_ = new WindowClassRegistrar(); 49 | } 50 | return instance_; 51 | } 52 | 53 | // Returns the name of the window class, registering the class if it hasn't 54 | // previously been registered. 55 | const wchar_t* GetWindowClass(); 56 | 57 | // Unregisters the window class. Should only be called if there are no 58 | // instances of the window. 59 | void UnregisterWindowClass(); 60 | 61 | private: 62 | WindowClassRegistrar() = default; 63 | 64 | static WindowClassRegistrar* instance_; 65 | 66 | bool class_registered_ = false; 67 | }; 68 | 69 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; 70 | 71 | const wchar_t* WindowClassRegistrar::GetWindowClass() { 72 | if (!class_registered_) { 73 | WNDCLASS window_class{}; 74 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); 75 | window_class.lpszClassName = kWindowClassName; 76 | window_class.style = CS_HREDRAW | CS_VREDRAW; 77 | window_class.cbClsExtra = 0; 78 | window_class.cbWndExtra = 0; 79 | window_class.hInstance = GetModuleHandle(nullptr); 80 | window_class.hIcon = 81 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); 82 | window_class.hbrBackground = 0; 83 | window_class.lpszMenuName = nullptr; 84 | window_class.lpfnWndProc = Win32Window::WndProc; 85 | RegisterClass(&window_class); 86 | class_registered_ = true; 87 | } 88 | return kWindowClassName; 89 | } 90 | 91 | void WindowClassRegistrar::UnregisterWindowClass() { 92 | UnregisterClass(kWindowClassName, nullptr); 93 | class_registered_ = false; 94 | } 95 | 96 | Win32Window::Win32Window() { 97 | ++g_active_window_count; 98 | } 99 | 100 | Win32Window::~Win32Window() { 101 | --g_active_window_count; 102 | Destroy(); 103 | } 104 | 105 | bool Win32Window::CreateAndShow(const std::wstring& title, 106 | const Point& origin, 107 | const Size& size) { 108 | Destroy(); 109 | 110 | const wchar_t* window_class = 111 | WindowClassRegistrar::GetInstance()->GetWindowClass(); 112 | 113 | const POINT target_point = {static_cast(origin.x), 114 | static_cast(origin.y)}; 115 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); 116 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); 117 | double scale_factor = dpi / 96.0; 118 | 119 | HWND window = CreateWindow( 120 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE, 121 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), 122 | Scale(size.width, scale_factor), Scale(size.height, scale_factor), 123 | nullptr, nullptr, GetModuleHandle(nullptr), this); 124 | 125 | if (!window) { 126 | return false; 127 | } 128 | 129 | return OnCreate(); 130 | } 131 | 132 | // static 133 | LRESULT CALLBACK Win32Window::WndProc(HWND const window, 134 | UINT const message, 135 | WPARAM const wparam, 136 | LPARAM const lparam) noexcept { 137 | if (message == WM_NCCREATE) { 138 | auto window_struct = reinterpret_cast(lparam); 139 | SetWindowLongPtr(window, GWLP_USERDATA, 140 | reinterpret_cast(window_struct->lpCreateParams)); 141 | 142 | auto that = static_cast(window_struct->lpCreateParams); 143 | EnableFullDpiSupportIfAvailable(window); 144 | that->window_handle_ = window; 145 | } else if (Win32Window* that = GetThisFromHandle(window)) { 146 | return that->MessageHandler(window, message, wparam, lparam); 147 | } 148 | 149 | return DefWindowProc(window, message, wparam, lparam); 150 | } 151 | 152 | LRESULT 153 | Win32Window::MessageHandler(HWND hwnd, 154 | UINT const message, 155 | WPARAM const wparam, 156 | LPARAM const lparam) noexcept { 157 | switch (message) { 158 | case WM_DESTROY: 159 | window_handle_ = nullptr; 160 | Destroy(); 161 | if (quit_on_close_) { 162 | PostQuitMessage(0); 163 | } 164 | return 0; 165 | 166 | case WM_DPICHANGED: { 167 | auto newRectSize = reinterpret_cast(lparam); 168 | LONG newWidth = newRectSize->right - newRectSize->left; 169 | LONG newHeight = newRectSize->bottom - newRectSize->top; 170 | 171 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, 172 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE); 173 | 174 | return 0; 175 | } 176 | case WM_SIZE: { 177 | RECT rect = GetClientArea(); 178 | if (child_content_ != nullptr) { 179 | // Size and position the child window. 180 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, 181 | rect.bottom - rect.top, TRUE); 182 | } 183 | return 0; 184 | } 185 | 186 | case WM_ACTIVATE: 187 | if (child_content_ != nullptr) { 188 | SetFocus(child_content_); 189 | } 190 | return 0; 191 | } 192 | 193 | return DefWindowProc(window_handle_, message, wparam, lparam); 194 | } 195 | 196 | void Win32Window::Destroy() { 197 | OnDestroy(); 198 | 199 | if (window_handle_) { 200 | DestroyWindow(window_handle_); 201 | window_handle_ = nullptr; 202 | } 203 | if (g_active_window_count == 0) { 204 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); 205 | } 206 | } 207 | 208 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { 209 | return reinterpret_cast( 210 | GetWindowLongPtr(window, GWLP_USERDATA)); 211 | } 212 | 213 | void Win32Window::SetChildContent(HWND content) { 214 | child_content_ = content; 215 | SetParent(content, window_handle_); 216 | RECT frame = GetClientArea(); 217 | 218 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left, 219 | frame.bottom - frame.top, true); 220 | 221 | SetFocus(child_content_); 222 | } 223 | 224 | RECT Win32Window::GetClientArea() { 225 | RECT frame; 226 | GetClientRect(window_handle_, &frame); 227 | return frame; 228 | } 229 | 230 | HWND Win32Window::GetHandle() { 231 | return window_handle_; 232 | } 233 | 234 | void Win32Window::SetQuitOnClose(bool quit_on_close) { 235 | quit_on_close_ = quit_on_close; 236 | } 237 | 238 | bool Win32Window::OnCreate() { 239 | // No-op; provided for subclasses. 240 | return true; 241 | } 242 | 243 | void Win32Window::OnDestroy() { 244 | // No-op; provided for subclasses. 245 | } 246 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /lib/disks_desktop.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Angelo Cassano 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | library disks; 27 | 28 | export 'src/exceptions/unsupported_platform_exception.dart'; 29 | export 'src/models/disk.dart'; 30 | export 'src/repositories/disks_repository.dart'; 31 | -------------------------------------------------------------------------------- /lib/src/exceptions/unsupported_platform_exception.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Angelo Cassano 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | class UnsupportedPlatformException implements Exception { 27 | final String platform; 28 | 29 | UnsupportedPlatformException(this.platform); 30 | 31 | @override 32 | String toString() => 'Unsupported platform $platform'; 33 | } 34 | -------------------------------------------------------------------------------- /lib/src/linux/lsblk.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Angelo Cassano 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | import 'dart:convert'; 27 | import 'dart:io'; 28 | 29 | class Lsblk { 30 | Future get query async { 31 | final process = await Process.start('lsblk', [ 32 | '--bytes', 33 | '--all', 34 | '--json', 35 | '--paths', 36 | '--output-all', 37 | ]); 38 | 39 | return await process.stdout.transform(utf8.decoder).join(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /lib/src/models/disk.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Angelo Cassano 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | import "package:equatable/equatable.dart"; 27 | import "package:path/path.dart" as path; 28 | 29 | enum PartitionTableType { mbr, gpt } 30 | 31 | class Mountpoint extends Equatable { 32 | final String path; 33 | final String? label; 34 | 35 | const Mountpoint({ 36 | required this.path, 37 | this.label, 38 | }); 39 | 40 | factory Mountpoint.fromMap(Map map) => Mountpoint( 41 | path: map['path'], 42 | label: map['label'], 43 | ); 44 | 45 | factory Mountpoint.fromLsblk(Map mountpoint) => Mountpoint( 46 | path: mountpoint["mountpoint"], 47 | label: mountpoint["label"] ?? mountpoint["partlabel"], 48 | ); 49 | 50 | @override 51 | List get props => [path, label]; 52 | 53 | @override 54 | String toString() => "Mountpoint{path: $path, label: $label}"; 55 | } 56 | 57 | class Disk extends Equatable { 58 | final int blockSize; 59 | final String busType; 60 | final String? busVersion; 61 | final String description; 62 | final String device; 63 | final String? devicePath; 64 | final String? error; 65 | final bool? card; 66 | final bool readOnly; 67 | final bool removable; 68 | final bool? scsi; 69 | final bool system; 70 | final bool? uas; 71 | final bool? usb; 72 | final bool? virtual; 73 | final int logicalBlockSize; 74 | final List mountpoints; 75 | final String raw; 76 | final int? size; 77 | final PartitionTableType? partitionTableType; 78 | 79 | const Disk({ 80 | required this.blockSize, 81 | required this.busType, 82 | this.busVersion, 83 | required this.description, 84 | required this.device, 85 | this.devicePath, 86 | this.error, 87 | this.card, 88 | required this.readOnly, 89 | required this.removable, 90 | this.scsi, 91 | required this.system, 92 | this.uas, 93 | this.usb, 94 | this.virtual, 95 | required this.logicalBlockSize, 96 | required this.mountpoints, 97 | required this.raw, 98 | this.size, 99 | this.partitionTableType, 100 | }); 101 | 102 | factory Disk.fromMap(Map map) => Disk( 103 | blockSize: map['blockSize'], 104 | busType: map['busType'], 105 | busVersion: map['busVersion'], 106 | description: map['description'], 107 | device: map['device'], 108 | devicePath: map['devicePath'], 109 | error: map['error'], 110 | card: map['card'], 111 | readOnly: map['readOnly'], 112 | removable: map['removable'], 113 | scsi: map['scsi'], 114 | system: map['system'], 115 | uas: map['uas'], 116 | usb: map['usb'], 117 | virtual: map['virtual'], 118 | logicalBlockSize: map['logicalBlockSize'], 119 | mountpoints: ((map['mountpoints'] ?? []) as List) 120 | .map((e) => Mountpoint.fromMap(Map.from(e))) 121 | .toList(growable: false), 122 | raw: map['raw'], 123 | size: map['size'], 124 | partitionTableType: map['partitionTableType'] == 'gpt' ? PartitionTableType.gpt : PartitionTableType.mbr, 125 | ); 126 | 127 | factory Disk.fromLsblk(Map device) { 128 | String? getDeviceName(String? value) { 129 | if (value != null) { 130 | return !path.isAbsolute(value) ? path.absolute("/dev", value) : value; 131 | } 132 | 133 | return null; 134 | } 135 | 136 | PartitionTableType? getPartitionTableType(String? value) => value == "gpt" 137 | ? PartitionTableType.gpt 138 | : value == "dos" 139 | ? PartitionTableType.mbr 140 | : null; 141 | 142 | String getDescription() { 143 | var description = [ 144 | device["label"] ?? "", 145 | device["vendor"] ?? "", 146 | device["model"] ?? "", 147 | ]; 148 | if (device["children"] != null) { 149 | final subLabels = (device["children"] as List) 150 | .where((children) => children["label"] != null 151 | ? children["label"] != device["label"] 152 | : children["mountpoint"] != null) 153 | .map((children) => children["label"] ?? children["mountpoint"]); 154 | if (subLabels.isNotEmpty) { 155 | description.add(subLabels.join(", ")); 156 | } 157 | } 158 | return description.join(" ").replaceAll(r"/\s+/g", " ").trim(); 159 | } 160 | 161 | final name = getDeviceName(device["name"]); 162 | final kname = getDeviceName(device["kname"]); 163 | final virtual = 164 | RegExp(r"/^(block)$/i").hasMatch(device["subsystems"] ?? ""); 165 | final scsi = 166 | RegExp(r"/^(sata|scsi|ata|ide|pci)$/i").hasMatch(device["tran"] ?? ""); 167 | final usb = RegExp(r"/^(usb)$/i").hasMatch(device["tran"] ?? ""); 168 | final readonly = device["ro"] == 1; 169 | final removable = device["rm"] == 1 || device["hotplug"] == 1 || virtual; 170 | 171 | return Disk( 172 | busType: (device["tran"] ?? "UNKNOWN").toUpperCase(), 173 | device: name ?? "", 174 | raw: kname ?? name ?? "", 175 | description: getDescription(), 176 | size: device["size"], 177 | blockSize: device["phy-sec"] ?? 512, 178 | logicalBlockSize: device["log-sec"] ?? 512, 179 | mountpoints: ((device["children"] ?? [device]) as List) 180 | .where((mountpoint) => mountpoint["mountpoint"] != null) 181 | .map((mountpoint) => Mountpoint.fromLsblk(mountpoint)) 182 | .toList(growable: false), 183 | readOnly: readonly, 184 | system: !removable && !virtual, 185 | virtual: virtual, 186 | removable: removable, 187 | scsi: scsi, 188 | usb: usb, 189 | partitionTableType: getPartitionTableType(device["pttype"]), 190 | ); 191 | } 192 | 193 | @override 194 | List get props => [ 195 | blockSize, 196 | busType, 197 | busVersion, 198 | description, 199 | device, 200 | devicePath, 201 | error, 202 | card, 203 | readOnly, 204 | removable, 205 | scsi, 206 | system, 207 | uas, 208 | usb, 209 | virtual, 210 | logicalBlockSize, 211 | mountpoints, 212 | raw, 213 | size, 214 | partitionTableType, 215 | ]; 216 | 217 | @override 218 | String toString() => 219 | "Disk{blockSize: $blockSize, busType: $busType, busVersion: $busVersion, description: $description, device: $device, devicePath: $devicePath, error: $error, card: $card, readOnly: $readOnly, removable: $removable, scsi: $scsi, system: $system, uas: $uas, usb: $usb, virtual: $virtual, logicalBlockSize: $logicalBlockSize, mountpoints: $mountpoints, raw: $raw, size: $size, partitionTableType: $partitionTableType}"; 220 | } 221 | 222 | 223 | -------------------------------------------------------------------------------- /lib/src/repositories/disks_repository.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Angelo Cassano 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | import 'dart:async'; 27 | import 'dart:convert'; 28 | import 'dart:io'; 29 | 30 | import 'package:disks_desktop/src/exceptions/unsupported_platform_exception.dart'; 31 | import 'package:disks_desktop/src/linux/lsblk.dart'; 32 | import 'package:disks_desktop/src/models/disk.dart'; 33 | import 'package:flutter/services.dart'; 34 | 35 | class DisksRepository { 36 | final Lsblk _lsblk; 37 | final MethodChannel _channel; 38 | 39 | DisksRepository({ 40 | MethodChannel? channel, 41 | Lsblk? lsblk, 42 | }) : _channel = channel ?? const MethodChannel('disks_desktop'), 43 | _lsblk = lsblk ?? Lsblk(); 44 | 45 | Future> get query async { 46 | if (Platform.isLinux) { 47 | final result = await _lsblk.query; 48 | final json = jsonDecode(result); 49 | 50 | return (json['blockdevices'] as List) 51 | .map((disk) => Disk.fromLsblk(disk as Map)) 52 | .where( 53 | (disk) => 54 | !disk.device.startsWith('/dev/loop') && 55 | !disk.device.startsWith('/dev/sr') && 56 | !disk.device.startsWith('/dev/ram'), 57 | ) 58 | .toList(growable: false); 59 | } else if (Platform.isMacOS || Platform.isWindows) { 60 | final results = await _channel.invokeListMethod('query'); 61 | return results 62 | ?.map((result) => Disk.fromMap(Map.from(result))) 63 | .toList(growable: false) ?? 64 | []; 65 | } 66 | 67 | throw UnsupportedPlatformException(Platform.operatingSystem); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /macos/Classes/DeviceManager.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Angelo Cassano 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | import Foundation 27 | import DiskArbitration 28 | 29 | public class DeviceManager { 30 | 31 | fileprivate var diskBsds : [String] = [] 32 | 33 | init() { 34 | if let session : DASession = DASessionCreate(CFAllocatorGetDefault().takeRetainedValue()) { 35 | let pointer = UnsafeMutableRawPointer(Unmanaged.passRetained(self).toOpaque()) 36 | 37 | DARegisterDiskAppearedCallback( 38 | session, 39 | nil, 40 | _volumeDetectedCallback, 41 | pointer) 42 | 43 | let runloop : CFRunLoop = CFRunLoopGetCurrent() 44 | 45 | DASessionScheduleWithRunLoop(session, runloop, CFRunLoopMode.defaultMode.rawValue) 46 | CFRunLoopStop(runloop) 47 | CFRunLoopRunInMode(CFRunLoopMode.defaultMode, 0.05, false) 48 | DAUnregisterCallback(session, pointer, nil) 49 | } 50 | 51 | } 52 | 53 | public func query() -> [Disk] { 54 | if let session : DASession = 55 | DASessionCreate(CFAllocatorGetDefault().takeRetainedValue()) { 56 | 57 | var disks : [Disk] = diskBsds.reduce(into: []) { disks, diskBsd in 58 | if (!_isPartition(disk: diskBsd)) { 59 | if let disk : DADisk = DADiskCreateFromBSDName(kCFAllocatorDefault, session, NSString(string: diskBsd).utf8String!) { 60 | if let diskDescription : [String: AnyObject] = DADiskCopyDescription(disk) as? [String: AnyObject] { 61 | 62 | let disk : Disk = _deviceFromNameAndDescription(diskBsd: diskBsd, diskDescription: diskDescription) 63 | 64 | disks.append(disk) 65 | } 66 | } 67 | } 68 | } 69 | 70 | let volumeKeys = [URLResourceKey.volumeNameKey, URLResourceKey.volumeLocalizedNameKey] 71 | if let volumePaths = FileManager().mountedVolumeURLs(includingResourceValuesForKeys: volumeKeys, options: []) { 72 | for path in volumePaths { 73 | if let volumeDisk : DADisk = DADiskCreateFromVolumePath(kCFAllocatorDefault, session, path as CFURL) { 74 | if let bsdName = DADiskGetBSDName(volumeDisk) { 75 | 76 | let strBsdName = String(cString: bsdName) 77 | let volume = try? path.resourceValues(forKeys: [URLResourceKey.volumeLocalizedNameKey]).allValues[URLResourceKey.volumeLocalizedNameKey] 78 | 79 | let offsetIndex = strBsdName.index(strBsdName.startIndex, offsetBy: 5) 80 | let substringIndex = strBsdName[offsetIndex...].firstIndex(of: "s")! 81 | 82 | let diskBsdName = strBsdName[strBsdName.startIndex.. Bool { 102 | let regex = try? NSRegularExpression(pattern: "disk\\d+s\\d+") 103 | return regex?.firstMatch(in: disk, options: [], range: NSRange(disk.startIndex.. Bool { 108 | if let iconDictionary : [String: AnyObject] = diskDescription[kDADiskDescriptionMediaIconKey as String] as? [String: AnyObject] { 109 | if let iconFileName : String = iconDictionary["IOBundleResourceFile"] as? String { 110 | return "SD.icns" == iconFileName 111 | } 112 | } 113 | 114 | return false; 115 | } 116 | 117 | private func _deviceFromNameAndDescription(diskBsd: String, diskDescription: [String: AnyObject]) -> Disk { 118 | let deviceProtocol : String? = diskDescription[kDADiskDescriptionDeviceProtocolKey as String] as? String 119 | let blockSize : UInt32? = diskDescription[kDADiskDescriptionMediaBlockSizeKey as String] as? UInt32 120 | let internalValue : Bool = diskDescription[kDADiskDescriptionDeviceInternalKey as String] as? Bool ?? false 121 | let removable : Bool = diskDescription[kDADiskDescriptionMediaRemovableKey as String] as? Bool ?? false 122 | let ejectable : Bool = diskDescription[kDADiskDescriptionMediaEjectableKey as String] as? Bool ?? false 123 | let mediaContent : String? = diskDescription[kDADiskDescriptionMediaContentKey as String] as? String 124 | let partitionTableType : PartitionTableType = "GUID_partition_scheme" == mediaContent ? PartitionTableType.gpt : PartitionTableType.mbr 125 | let devicePath : String? = diskDescription[kDADiskDescriptionBusPathKey as String] as? String 126 | let description : String? = diskDescription[kDADiskDescriptionMediaNameKey as String] as? String 127 | let size : UInt64? = diskDescription[kDADiskDescriptionMediaSizeKey as String] as? UInt64 128 | let readOnly : Bool = diskDescription[kDADiskDescriptionMediaWritableKey as String] as? Bool ?? false 129 | let scsi : Bool = ["SATA", "SCSI", "ATA", "IDE", "PCI"].contains(deviceProtocol ?? "") 130 | let virtual : Bool = "Virtual Interface" == (deviceProtocol ?? "") 131 | let usb : Bool = "USB" == (deviceProtocol ?? "") 132 | let card : Bool = _isCard(diskDescription: diskDescription) 133 | 134 | return Disk.init(busType: deviceProtocol, busVersion: nil, busVersionNull: true, device: "/dev/\(diskBsd)", devicePath: devicePath, devicePathNull: devicePath != nil, raw: "/dev/r\(diskBsd)", description: description, error: nil, partitionTableType: partitionTableType, size: size ?? 0, blockSize: blockSize ?? 512, logicalBlockSize: blockSize ?? 512, readOnly: readOnly, system: internalValue && !removable, virtual: virtual, removable: removable || ejectable, card: card, SCSI: scsi, USB: usb, UAS: false, UASNull: true) 135 | } 136 | 137 | } 138 | 139 | fileprivate func _volumeDetectedCallback(disk: DADisk, pointer: UnsafeMutableRawPointer?) { 140 | if let name = DADiskGetBSDName(disk) { 141 | let strName : String = String(cString:name) 142 | let repository : DeviceManager = Unmanaged.fromOpaque(pointer!).takeUnretainedValue() 143 | 144 | repository.diskBsds.append(strName) 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /macos/Classes/Disk.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Angelo Cassano 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | import Foundation 27 | 28 | enum PartitionTableType { 29 | case mbr 30 | case gpt 31 | } 32 | 33 | public struct Mountpoint { 34 | let path : String 35 | let label: String? 36 | 37 | public func toMap() -> [String: Any?] { 38 | return [ 39 | "path": path, 40 | "label": label, 41 | ] 42 | } 43 | } 44 | 45 | public struct Disk { 46 | let busType : String? 47 | let busVersion : String? 48 | let busVersionNull : Bool 49 | let device : String 50 | let devicePath : String? 51 | let devicePathNull : Bool 52 | let raw : String 53 | let description : String? 54 | let error : String? 55 | let partitionTableType : PartitionTableType 56 | let size : UInt64 57 | let blockSize : UInt32 58 | let logicalBlockSize : UInt32 59 | var mountpoints : [Mountpoint] = [] 60 | let readOnly : Bool 61 | let system : Bool 62 | let virtual : Bool 63 | let removable : Bool 64 | let card : Bool 65 | let SCSI : Bool 66 | let USB : Bool 67 | let UAS : Bool 68 | let UASNull : Bool 69 | 70 | public func toMap() -> [String: Any?] { 71 | return [ 72 | "blockSize": blockSize, 73 | "busType": busType, 74 | "busVersion": busVersion, 75 | "description": description, 76 | "device": device, 77 | "devicePath": devicePath, 78 | "error": error, 79 | "card": card, 80 | "readOnly": readOnly, 81 | "removable": removable, 82 | "scsi": SCSI, 83 | "system": self.system, 84 | "uas": UAS, 85 | "usb": USB, 86 | "virtual": virtual, 87 | "logicalBlockSize": logicalBlockSize, 88 | "mountpoints": mountpoints.map { $0.toMap() }, 89 | "raw": raw, 90 | "size": size, 91 | "partitionTableType": partitionTableType == PartitionTableType.gpt ? "gpt" : "mbr", 92 | ] 93 | } 94 | }; 95 | -------------------------------------------------------------------------------- /macos/Classes/DisksDesktopPlugin.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Angelo Cassano 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | import Cocoa 27 | import FlutterMacOS 28 | 29 | public class DisksDesktopPlugin: NSObject, FlutterPlugin { 30 | 31 | private let deviceManager : DeviceManager = DeviceManager() 32 | 33 | public static func register(with registrar: FlutterPluginRegistrar) { 34 | let channel = FlutterMethodChannel(name: "disks_desktop", binaryMessenger: registrar.messenger) 35 | let instance = DisksDesktopPlugin() 36 | registrar.addMethodCallDelegate(instance, channel: channel) 37 | } 38 | 39 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { 40 | switch call.method { 41 | case "query": 42 | let disks : [Disk] = deviceManager.query() 43 | result(disks.map { $0.toMap() }) 44 | default: 45 | result(FlutterMethodNotImplemented) 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /macos/disks_desktop.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. 3 | # Run `pod lib lint disks_desktop.podspec` to validate before publishing. 4 | # 5 | Pod::Spec.new do |s| 6 | s.name = 'disks_desktop' 7 | s.version = '1.0.1' 8 | s.summary = 'A new flutter plugin project.' 9 | s.description = <<-DESC 10 | A new flutter plugin project. 11 | DESC 12 | s.homepage = 'http://example.com' 13 | s.license = { :file => '../LICENSE' } 14 | s.author = { 'Your Company' => 'email@example.com' } 15 | s.source = { :path => '.' } 16 | s.source_files = 'Classes/**/*' 17 | s.dependency 'FlutterMacOS' 18 | 19 | s.platform = :osx, '10.11' 20 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } 21 | s.swift_version = '5.0' 22 | end 23 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: disks_desktop 2 | description: A Flutter desktop library able to retrieve the installed devices information 3 | version: 1.0.1 4 | repository: https://github.com/AngeloAvv/disks 5 | issue_tracker: https://github.com/AngeloAvv/disks/issues 6 | homepage: https://www.angelocassano.it 7 | 8 | environment: 9 | sdk: ">=2.17.6 <3.0.0" 10 | flutter: ">=3.3.2" 11 | 12 | dependencies: 13 | flutter: 14 | sdk: flutter 15 | equatable: ^2.0.5 16 | path: ^1.8.2 17 | 18 | dev_dependencies: 19 | flutter_test: 20 | sdk: flutter 21 | flutter_lints: ^2.0.1 22 | mockito: ^5.3.1 23 | build_runner: ^2.2.1 24 | 25 | flutter: 26 | plugin: 27 | platforms: 28 | macos: 29 | pluginClass: DisksDesktopPlugin 30 | windows: 31 | pluginClass: DisksDesktopPlugin -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "config:base" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /test/linux/disks_test.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Angelo Cassano 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | import 'dart:io'; 27 | 28 | import 'package:disks_desktop/disks_desktop.dart'; 29 | import 'package:disks_desktop/src/linux/lsblk.dart'; 30 | import 'package:flutter_test/flutter_test.dart'; 31 | import 'package:mockito/annotations.dart'; 32 | import 'package:mockito/mockito.dart'; 33 | 34 | import 'disks_test.mocks.dart'; 35 | 36 | @GenerateMocks([Lsblk]) 37 | void main() { 38 | late Lsblk lsblk; 39 | late DisksRepository disksRepository; 40 | 41 | setUp(() { 42 | lsblk = MockLsblk(); 43 | disksRepository = DisksRepository(lsblk: lsblk); 44 | }); 45 | 46 | test('get disks from linux platform', () async { 47 | final jsonString = File('test/linux/lsblk.json').readAsStringSync(); 48 | when(lsblk.query).thenAnswer((_) async => jsonString); 49 | 50 | final disks = await disksRepository.query; 51 | 52 | expect(disks, isNotNull); 53 | expect(disks, isNotEmpty); 54 | expect(disks.length, 2); 55 | 56 | expect(disks.first.blockSize, 512); 57 | expect(disks.first.busType, "NVME"); 58 | expect(disks.first.busVersion, isNull); 59 | expect(disks.first.description, 60 | "GIGABYTE GP-ASM2NE6100TTTD /boot/efi, /, [SWAP]"); 61 | expect(disks.first.device, "/dev/nvme0n1"); 62 | expect(disks.first.devicePath, isNull); 63 | expect(disks.first.error, isNull); 64 | expect(disks.first.card, isNull); 65 | expect(disks.first.readOnly, false); 66 | expect(disks.first.removable, false); 67 | expect(disks.first.scsi, false); 68 | expect(disks.first.system, true); 69 | expect(disks.first.uas, isNull); 70 | expect(disks.first.usb, false); 71 | expect(disks.first.virtual, false); 72 | expect(disks.first.logicalBlockSize, 512); 73 | expect(disks.first.mountpoints[0].path, "/boot/efi"); 74 | expect(disks.first.mountpoints[1].path, "/"); 75 | expect(disks.first.mountpoints[2].path, "[SWAP]"); 76 | expect(disks.first.mountpoints[0].label, isNull); 77 | expect(disks.first.mountpoints[1].label, isNull); 78 | expect(disks.first.mountpoints[2].label, isNull); 79 | expect(disks.first.raw, "/dev/nvme0n1"); 80 | expect(disks.first.size, 1000204886016); 81 | expect(disks.first.partitionTableType, PartitionTableType.gpt); 82 | 83 | expect(disks.last.blockSize, 512); 84 | expect(disks.last.busType, "NVME"); 85 | expect(disks.last.busVersion, isNull); 86 | expect(disks.last.description, "Samsung SSD 970 EVO Plus 1TB"); 87 | expect(disks.last.device, "/dev/nvme1n1"); 88 | expect(disks.last.devicePath, isNull); 89 | expect(disks.last.error, isNull); 90 | expect(disks.last.card, isNull); 91 | expect(disks.last.readOnly, false); 92 | expect(disks.last.removable, false); 93 | expect(disks.last.scsi, false); 94 | expect(disks.last.system, true); 95 | expect(disks.last.uas, isNull); 96 | expect(disks.last.usb, false); 97 | expect(disks.last.virtual, false); 98 | expect(disks.last.logicalBlockSize, 512); 99 | expect(disks.last.mountpoints, isEmpty); 100 | expect(disks.last.raw, "/dev/nvme1n1"); 101 | expect(disks.last.size, 1000204886016); 102 | expect(disks.last.partitionTableType, PartitionTableType.gpt); 103 | }); 104 | } 105 | -------------------------------------------------------------------------------- /test/macos/disks_test.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Angelo Cassano 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | import 'dart:convert'; 27 | import 'dart:io'; 28 | 29 | import 'package:disks_desktop/disks_desktop.dart'; 30 | import 'package:flutter/services.dart'; 31 | import 'package:flutter_test/flutter_test.dart'; 32 | 33 | void main() { 34 | late MethodChannel methodChannel; 35 | late DisksRepository disksRepository; 36 | 37 | setUp(() { 38 | methodChannel = const MethodChannel('disks'); 39 | disksRepository = DisksRepository(channel: methodChannel); 40 | }); 41 | 42 | testWidgets('get disks from macos platform', (tester) async { 43 | final jsonString = 44 | File('test/macos/method_channel.json').readAsStringSync(); 45 | final json = jsonDecode(jsonString); 46 | 47 | tester.binding.defaultBinaryMessenger 48 | .setMockMethodCallHandler(methodChannel, (call) async { 49 | if (call.method == 'query') { 50 | return await json; 51 | } 52 | 53 | return null; 54 | }); 55 | 56 | final disks = await disksRepository.query; 57 | 58 | expect(disks, isNotNull); 59 | expect(disks, isNotEmpty); 60 | expect(disks.length, 3); 61 | 62 | var i = 0; 63 | while (i < disks.length) { 64 | expect(disks[i].blockSize, json[i]["blockSize"]); 65 | expect(disks[i].busType, json[i]["busType"]); 66 | expect(disks[i].busVersion, json[i]["busVersion"]); 67 | expect(disks[i].description, json[i]["description"]); 68 | expect(disks[i].device, json[i]["device"]); 69 | expect(disks[i].devicePath, json[i]["devicePath"]); 70 | expect(disks[i].error, json[i]["error"]); 71 | expect(disks[i].card, json[i]["card"]); 72 | expect(disks[i].readOnly, json[i]["readOnly"]); 73 | expect(disks[i].removable, json[i]["removable"]); 74 | expect(disks[i].scsi, json[i]["scsi"]); 75 | expect(disks[i].system, json[i]["system"]); 76 | expect(disks[i].uas, json[i]["uas"]); 77 | expect(disks[i].usb, json[i]["usb"]); 78 | expect(disks[i].virtual, json[i]["virtual"]); 79 | expect(disks[i].logicalBlockSize, json[i]["logicalBlockSize"]); 80 | expect(disks[i].raw, json[i]["raw"]); 81 | expect(disks[i].size, json[i]["size"]); 82 | expect(disks[i].partitionTableType?.name, json[i]["partitionTableType"]); 83 | 84 | var j = 0; 85 | while (j < disks[i].mountpoints.length) { 86 | expect(disks[i].mountpoints[j].path, json[i]["mountpoints"][j]["path"]); 87 | expect( 88 | disks[i].mountpoints[j].label, json[i]["mountpoints"][j]["label"]); 89 | 90 | j++; 91 | } 92 | 93 | i++; 94 | } 95 | }); 96 | } 97 | -------------------------------------------------------------------------------- /test/macos/method_channel.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "blockSize": 512, 4 | "description": "Samsung SSD 970 EVO Plus 1TB Media", 5 | "card": false, 6 | "device": "/dev/disk0", 7 | "readOnly": true, 8 | "size": 1000204886016, 9 | "system": true, 10 | "usb": false, 11 | "error": null, 12 | "busVersion": null, 13 | "removable": false, 14 | "virtual": false, 15 | "logicalBlockSize": 512, 16 | "mountpoints": [ 17 | { 18 | "label": "Untitled", 19 | "path": "/Volumes/Untitled" 20 | } 21 | ], 22 | "partitionTableType": "gpt", 23 | "busType": "PCI-Express", 24 | "raw": "/dev/rdisk0", 25 | "scsi": false, 26 | "uas": false, 27 | "devicePath": "IODeviceTree:/PCI0@0/BXBR@1,2/BYUP@0/BYD1@1/BYS1@0/IONVMeController" 28 | }, 29 | { 30 | "raw": "/dev/rdisk1", 31 | "description": "GIGABYTE GP-ASM2NE6100TTTD Media", 32 | "removable": false, 33 | "system": false, 34 | "logicalBlockSize": 512, 35 | "mountpoints": [], 36 | "scsi": false, 37 | "virtual": false, 38 | "card": false, 39 | "usb": false, 40 | "busVersion": null, 41 | "size": 1000204886016, 42 | "partitionTableType": "gpt", 43 | "device": "/dev/disk1", 44 | "busType": "PCI-Express", 45 | "error": null, 46 | "blockSize": 512, 47 | "readOnly": true, 48 | "uas": false, 49 | "devicePath": "IODeviceTree:/PCI0@0/GPP0@1,1/pci1987,5016@0/IONVMeController" 50 | }, 51 | { 52 | "error": null, 53 | "size": 217391501312, 54 | "device": "/dev/disk2", 55 | "devicePath": "IODeviceTree:/PCI0@0/GPP0@1,1/pci1987,5016@0/IONVMeController", 56 | "busType": "PCI-Express", 57 | "blockSize": 4096, 58 | "card": false, 59 | "virtual": false, 60 | "scsi": false, 61 | "removable": false, 62 | "busVersion": null, 63 | "uas": false, 64 | "usb": false, 65 | "logicalBlockSize": 4096, 66 | "description": "AppleAPFSMedia", 67 | "readOnly": true, 68 | "system": false, 69 | "mountpoints": [ 70 | { 71 | "label": "macOS", 72 | "path": "/" 73 | }, 74 | { 75 | "path": "/System/Volumes/VM", 76 | "label": "VM" 77 | }, 78 | { 79 | "path": "/System/Volumes/Preboot", 80 | "label": "Preboot" 81 | }, 82 | { 83 | "label": "Update", 84 | "path": "/System/Volumes/Update" 85 | } 86 | ], 87 | "raw": "/dev/rdisk2", 88 | "partitionTableType": "mbr" 89 | } 90 | ] -------------------------------------------------------------------------------- /test/windows/disks_test.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Angelo Cassano 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | import 'dart:convert'; 27 | import 'dart:io'; 28 | 29 | import 'package:disks_desktop/disks_desktop.dart'; 30 | import 'package:flutter/services.dart'; 31 | import 'package:flutter_test/flutter_test.dart'; 32 | 33 | void main() { 34 | late MethodChannel methodChannel; 35 | late DisksRepository disksRepository; 36 | 37 | setUp(() { 38 | methodChannel = const MethodChannel('disks'); 39 | disksRepository = DisksRepository(channel: methodChannel); 40 | }); 41 | 42 | testWidgets('get disks from windows platform', (tester) async { 43 | final jsonString = 44 | File('test/windows/method_channel.json').readAsStringSync(); 45 | final json = jsonDecode(jsonString); 46 | 47 | tester.binding.defaultBinaryMessenger 48 | .setMockMethodCallHandler(methodChannel, (call) async { 49 | if (call.method == 'query') { 50 | return await json; 51 | } 52 | 53 | return null; 54 | }); 55 | 56 | final disks = await disksRepository.query; 57 | 58 | expect(disks, isNotNull); 59 | expect(disks, isNotEmpty); 60 | expect(disks.length, 2); 61 | 62 | var i = 0; 63 | while (i < disks.length) { 64 | expect(disks[i].blockSize, json[i]["blockSize"]); 65 | expect(disks[i].busType, json[i]["busType"]); 66 | expect(disks[i].busVersion, json[i]["busVersion"]); 67 | expect(disks[i].description, json[i]["description"]); 68 | expect(disks[i].device, json[i]["device"]); 69 | expect(disks[i].devicePath, json[i]["devicePath"]); 70 | expect(disks[i].error, json[i]["error"]); 71 | expect(disks[i].card, json[i]["card"]); 72 | expect(disks[i].readOnly, json[i]["readOnly"]); 73 | expect(disks[i].removable, json[i]["removable"]); 74 | expect(disks[i].scsi, json[i]["scsi"]); 75 | expect(disks[i].system, json[i]["system"]); 76 | expect(disks[i].uas, json[i]["uas"]); 77 | expect(disks[i].usb, json[i]["usb"]); 78 | expect(disks[i].virtual, json[i]["virtual"]); 79 | expect(disks[i].logicalBlockSize, json[i]["logicalBlockSize"]); 80 | expect(disks[i].raw, json[i]["raw"]); 81 | expect(disks[i].size, json[i]["size"]); 82 | expect(disks[i].partitionTableType?.name, json[i]["partitionTableType"]); 83 | 84 | var j = 0; 85 | while (j < disks[i].mountpoints.length) { 86 | expect(disks[i].mountpoints[j].path, json[i]["mountpoints"][j]["path"]); 87 | expect( 88 | disks[i].mountpoints[j].label, json[i]["mountpoints"][j]["label"]); 89 | 90 | j++; 91 | } 92 | 93 | i++; 94 | } 95 | }); 96 | } 97 | -------------------------------------------------------------------------------- /test/windows/method_channel.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "blockSize": 4096, 4 | "busType": "INVALID", 5 | "busVersion": "2.0", 6 | "card": false, 7 | "description": "Samsung SSD 970 EVO Plus 1TB", 8 | "device": "\\\\.\\PhysicalDrive1", 9 | "devicePath": "", 10 | "error": "", 11 | "logicalBlockSize": 512, 12 | "mountpoints": [ 13 | { 14 | "label": "", 15 | "path": "C:\\" 16 | } 17 | ], 18 | "partitionTableType": "gpt", 19 | "raw": "\\\\.\\PhysicalDrive1", 20 | "readOnly": false, 21 | "removable": false, 22 | "scsi": true, 23 | "size": 1000204886016, 24 | "system": true, 25 | "uas": false, 26 | "usb": false, 27 | "virtual": false 28 | }, 29 | { 30 | "blockSize": 4096, 31 | "busType": "INVALID", 32 | "busVersion": "2.0", 33 | "card": false, 34 | "description": "GIGABYTE GP-ASM2NE6100TTTD", 35 | "device": "\\\\.\\PhysicalDrive0", 36 | "devicePath": "", 37 | "error": "", 38 | "logicalBlockSize": 512, 39 | "mountpoints": [], 40 | "partitionTableType": "gpt", 41 | "raw": "\\\\.\\PhysicalDrive0", 42 | "readOnly": false, 43 | "removable": false, 44 | "scsi": true, 45 | "size": 1000204886016, 46 | "system": true, 47 | "uas": false, 48 | "usb": false, 49 | "virtual": false 50 | } 51 | ] -------------------------------------------------------------------------------- /windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ 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 | cmake_minimum_required(VERSION 3.14) 2 | set(PROJECT_NAME "disks_desktop") 3 | project(${PROJECT_NAME} LANGUAGES CXX) 4 | 5 | # This value is used when generating builds using this plugin, so it must 6 | # not be changed 7 | set(PLUGIN_NAME "disks_desktop_plugin") 8 | 9 | set(SETUPAPI_LIB "Setupapi.lib") 10 | 11 | add_library(${PLUGIN_NAME} SHARED 12 | "disks_desktop_plugin.cpp" 13 | ) 14 | apply_standard_settings(${PLUGIN_NAME}) 15 | set_target_properties(${PLUGIN_NAME} PROPERTIES 16 | CXX_VISIBILITY_PRESET hidden) 17 | target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL) 18 | target_include_directories(${PLUGIN_NAME} INTERFACE 19 | "${CMAKE_CURRENT_SOURCE_DIR}/include") 20 | target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin) 21 | target_link_libraries(${PLUGIN_NAME} PRIVATE ${SETUPAPI_LIB}) 22 | 23 | # List of absolute paths to libraries that should be bundled with the plugin 24 | set(disks_desktop_bundled_libraries 25 | "" 26 | PARENT_SCOPE 27 | ) 28 | -------------------------------------------------------------------------------- /windows/disks_desktop_plugin.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Angelo Cassano 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #include "include/disks_desktop/disks_desktop_plugin.h" 27 | 28 | // This must be included before many other Windows headers. 29 | #include 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #include "include/disks_desktop/drivelist.cpp" 41 | #include "include/disks_desktop/list.cpp" 42 | 43 | namespace { 44 | 45 | class DisksDesktopPlugin : public flutter::Plugin { 46 | public: 47 | static void RegisterWithRegistrar(flutter::PluginRegistrarWindows *registrar); 48 | 49 | DisksDesktopPlugin(); 50 | 51 | virtual ~DisksDesktopPlugin(); 52 | 53 | private: 54 | // Called when a method is called on this plugin's channel from Dart. 55 | void HandleMethodCall( 56 | const flutter::MethodCall &method_call, 57 | std::unique_ptr> result); 58 | }; 59 | 60 | // static 61 | void DisksDesktopPlugin::RegisterWithRegistrar( 62 | flutter::PluginRegistrarWindows *registrar) { 63 | auto channel = 64 | std::make_unique>( 65 | registrar->messenger(), "disks_desktop", 66 | &flutter::StandardMethodCodec::GetInstance()); 67 | 68 | auto plugin = std::make_unique(); 69 | 70 | channel->SetMethodCallHandler( 71 | [plugin_pointer = plugin.get()](const auto &call, auto result) { 72 | plugin_pointer->HandleMethodCall(call, std::move(result)); 73 | }); 74 | 75 | registrar->AddPlugin(std::move(plugin)); 76 | } 77 | 78 | DisksDesktopPlugin::DisksDesktopPlugin() {} 79 | 80 | DisksDesktopPlugin::~DisksDesktopPlugin() {} 81 | 82 | void DisksDesktopPlugin::HandleMethodCall( 83 | const flutter::MethodCall &method_call, 84 | std::unique_ptr> result) { 85 | if (method_call.method_name().compare("query") == 0) { 86 | DriveListWorker* worker = new DriveListWorker(); 87 | flutter::EncodableList devices = worker->GetDevices(); 88 | 89 | result->Success(devices); 90 | } else { 91 | result->NotImplemented(); 92 | } 93 | } 94 | 95 | } // namespace 96 | 97 | void DisksDesktopPluginRegisterWithRegistrar( 98 | FlutterDesktopPluginRegistrarRef registrar) { 99 | DisksDesktopPlugin::RegisterWithRegistrar( 100 | flutter::PluginRegistrarManager::GetInstance() 101 | ->GetRegistrar(registrar)); 102 | } 103 | -------------------------------------------------------------------------------- /windows/include/disks_desktop/disks_desktop_plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022 Angelo Cassano 3 | * 4 | * Permission is hereby granted, free of charge, to any person 5 | * obtaining a copy of this software and associated documentation 6 | * files (the "Software"), to deal in the Software without 7 | * restriction, including without limitation the rights to use, 8 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the 10 | * Software is furnished to do so, subject to the following 11 | * conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | * OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | 27 | #ifndef FLUTTER_PLUGIN_DISKS_DESKTOP_PLUGIN_H_ 28 | #define FLUTTER_PLUGIN_DISKS_DESKTOP_PLUGIN_H_ 29 | 30 | #include 31 | 32 | #ifdef FLUTTER_PLUGIN_IMPL 33 | #define FLUTTER_PLUGIN_EXPORT __declspec(dllexport) 34 | #else 35 | #define FLUTTER_PLUGIN_EXPORT __declspec(dllimport) 36 | #endif 37 | 38 | #if defined(__cplusplus) 39 | extern "C" { 40 | #endif 41 | 42 | FLUTTER_PLUGIN_EXPORT void DisksDesktopPluginRegisterWithRegistrar( 43 | FlutterDesktopPluginRegistrarRef registrar); 44 | 45 | #if defined(__cplusplus) 46 | } // extern "C" 47 | #endif 48 | 49 | #endif // FLUTTER_PLUGIN_DISKS_DESKTOP_PLUGIN_H_ 50 | -------------------------------------------------------------------------------- /windows/include/disks_desktop/drivelist.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 balena.io 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include 20 | #include "drivelist.hpp" 21 | 22 | class DriveListWorker { 23 | public: 24 | explicit DriveListWorker(){} 25 | 26 | ~DriveListWorker() {} 27 | 28 | flutter::EncodableList GetDevices() { 29 | flutter::EncodableList encodedDevices; 30 | std::vector devices = Drivelist::ListStorageDevices(); 31 | 32 | for (Drivelist::DeviceDescriptor device : devices) { 33 | flutter::EncodableList encodedMountpoints; 34 | for (int i = 0; i < device.mountpoints.size(); i++) { 35 | std::string path = device.mountpoints[i]; 36 | std::string label; 37 | 38 | if (i < device.mountpointLabels.size()) { 39 | label = device.mountpointLabels[i]; 40 | } 41 | 42 | flutter::EncodableMap encodedMountpoint = { 43 | {flutter::EncodableValue("path"), flutter::EncodableValue(path)}, 44 | {flutter::EncodableValue("label"), flutter::EncodableValue(label)}, 45 | }; 46 | 47 | encodedMountpoints.push_back(encodedMountpoint); 48 | } 49 | 50 | flutter::EncodableMap encodedDevice = { 51 | {flutter::EncodableValue("blockSize"), flutter::EncodableValue(device.blockSize)}, 52 | {flutter::EncodableValue("busType"), flutter::EncodableValue(device.busType)}, 53 | {flutter::EncodableValue("busVersion"), flutter::EncodableValue(device.busVersion)}, 54 | {flutter::EncodableValue("description"), flutter::EncodableValue(device.description)}, 55 | {flutter::EncodableValue("device"), flutter::EncodableValue(device.device)}, 56 | {flutter::EncodableValue("devicePath"), flutter::EncodableValue(device.devicePath)}, 57 | {flutter::EncodableValue("error"), flutter::EncodableValue(device.error)}, 58 | {flutter::EncodableValue("card"), flutter::EncodableValue(device.isCard)}, 59 | {flutter::EncodableValue("readOnly"), flutter::EncodableValue(device.isReadOnly)}, 60 | {flutter::EncodableValue("removable"), flutter::EncodableValue(device.isRemovable)}, 61 | {flutter::EncodableValue("scsi"), flutter::EncodableValue(device.isSCSI)}, 62 | {flutter::EncodableValue("system"), flutter::EncodableValue(device.isSystem)}, 63 | {flutter::EncodableValue("uas"), flutter::EncodableValue(device.isUAS)}, 64 | {flutter::EncodableValue("usb"), flutter::EncodableValue(device.isUSB)}, 65 | {flutter::EncodableValue("virtual"), flutter::EncodableValue(device.isVirtual)}, 66 | {flutter::EncodableValue("logicalBlockSize"), flutter::EncodableValue(device.logicalBlockSize)}, 67 | {flutter::EncodableValue("mountpoints"), encodedMountpoints}, 68 | {flutter::EncodableValue("raw"), flutter::EncodableValue(device.raw)}, 69 | {flutter::EncodableValue("size"), flutter::EncodableValue(device.size)}, 70 | {flutter::EncodableValue("partitionTableType"), flutter::EncodableValue(device.partitionTableType)}, 71 | }; 72 | 73 | encodedDevices.push_back(encodedDevice); 74 | 75 | } 76 | 77 | return encodedDevices; 78 | } 79 | }; 80 | -------------------------------------------------------------------------------- /windows/include/disks_desktop/drivelist.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 balena.io 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef SRC_DRIVELIST_HPP_ 18 | #define SRC_DRIVELIST_HPP_ 19 | 20 | #include 21 | #include 22 | 23 | namespace Drivelist { 24 | 25 | struct MountPoint { 26 | std::string path; 27 | }; 28 | 29 | struct DeviceDescriptor { 30 | std::string enumerator; 31 | std::string busType; 32 | std::string busVersion; 33 | bool busVersionNull; 34 | std::string device; 35 | std::string devicePath; 36 | bool devicePathNull; 37 | std::string raw; 38 | std::string description; 39 | std::string error; 40 | std::string partitionTableType; 41 | int64_t size; 42 | int32_t blockSize = 512; 43 | int32_t logicalBlockSize = 512; 44 | std::vector mountpoints; 45 | std::vector mountpointLabels; 46 | bool isReadOnly; // Device is read-only 47 | bool isSystem; // Device is a system drive 48 | bool isVirtual; // Device is a virtual storage device 49 | bool isRemovable; // Device is removable from the running system 50 | bool isCard; // Device is an SD-card 51 | bool isSCSI; // Connected via the Small Computer System Interface (SCSI) 52 | bool isUSB; // Connected via Universal Serial Bus (USB) 53 | bool isUAS; // Connected via the USB Attached SCSI (UAS) 54 | bool isUASNull; 55 | }; 56 | 57 | std::vector ListStorageDevices(); 58 | 59 | } // namespace Drivelist 60 | 61 | #endif // SRC_DRIVELIST_HPP_ -------------------------------------------------------------------------------- /windows/include/disks_desktop/list.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 balena.io 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef SRC_WINDOWS_LIST_HPP_ 18 | #define SRC_WINDOWS_LIST_HPP_ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace Drivelist { 25 | 26 | // The , and headers include the following 27 | // device interface GUIDs we're interested in; 28 | // @see https://docs.microsoft.com/en-us/windows-hardware/drivers/install/install-reference 29 | // @see https://msdn.microsoft.com/en-us/library/windows/hardware/ff541389(v=vs.85).aspx 30 | // To avoid cluttering the global namespace, 31 | // we'll just define here what we need: 32 | // 33 | // - GUID_DEVINTERFACE_DISK { 53F56307-B6BF-11D0-94F2-00A0C91EFB8B } 34 | // - GUID_DEVINTERFACE_CDROM { 53F56308-B6BF-11D0-94F2-00A0C91EFB8B } 35 | // - GUID_DEVINTERFACE_USB_HUB { F18A0E88-C30C-11D0-8815-00A0C906BED8 } 36 | // - GUID_DEVINTERFACE_FLOPPY { 53F56311-B6BF-11D0-94F2-00A0C91EFB8B } 37 | // - GUID_DEVINTERFACE_WRITEONCEDISK { 53F5630C-B6BF-11D0-94F2-00A0C91EFB8B } 38 | // - GUID_DEVINTERFACE_TAPE { 53F5630B-B6BF-11D0-94F2-00A0C91EFB8B } 39 | // - GUID_DEVINTERFACE_USB_DEVICE { A5DCBF10-6530-11D2-901F-00C04FB951ED } 40 | // - GUID_DEVINTERFACE_VOLUME { 53F5630D-B6BF-11D0-94F2-00A0C91EFB8B } 41 | // - GUID_DEVINTERFACE_STORAGEPORT { 2ACCFE60-C130-11D2-B082-00A0C91EFB8B } 42 | // 43 | const GUID GUID_DEVICE_INTERFACE_DISK = { 44 | 0x53F56307L, 0xB6BF, 0x11D0, { 0x94, 0xF2, 0x00, 0xA0, 0xC9, 0x1E, 0xFB, 0x8B } 45 | }; 46 | 47 | const GUID GUID_DEVICE_INTERFACE_CDROM = { 48 | 0x53F56308L, 0xB6BF, 0x11D0, { 0x94, 0xF2, 0x00, 0xA0, 0xC9, 0x1E, 0xFB, 0x8B } 49 | }; 50 | 51 | const GUID GUID_DEVICE_INTERFACE_USB_HUB = { 52 | 0xF18A0E88L, 0xC30C, 0x11D0, { 0x88, 0x15, 0x00, 0xA0, 0xC9, 0x06, 0xBE, 0xD8 } 53 | }; 54 | 55 | const GUID GUID_DEVICE_INTERFACE_FLOPPY = { 56 | 0x53F56311L, 0xB6BF, 0x11D0, { 0x94, 0xF2, 0x00, 0xA0, 0xC9, 0x1E, 0xFB, 0x8B } 57 | }; 58 | 59 | const GUID GUID_DEVICE_INTERFACE_WRITEONCEDISK = { 60 | 0x53F5630CL, 0xB6BF, 0x11D0, { 0x94, 0xF2, 0x00, 0xA0, 0xC9, 0x1E, 0xFB, 0x8B } 61 | }; 62 | 63 | const GUID GUID_DEVICE_INTERFACE_TAPE = { 64 | 0x53F5630BL, 0xB6BF, 0x11D0, { 0x94, 0xF2, 0x00, 0xA0, 0xC9, 0x1E, 0xFB, 0x8B } 65 | }; 66 | 67 | const GUID GUID_DEVICE_INTERFACE_USB_DEVICE = { 68 | 0xA5DCBF10L, 0x6530, 0x11D2, { 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED } 69 | }; 70 | 71 | const GUID GUID_DEVICE_INTERFACE_VOLUME = { 72 | 0x53F5630DL, 0xB6BF, 0x11D0, { 0x94, 0xF2, 0x00, 0xA0, 0xC9, 0x1E, 0xFB, 0x8B } 73 | }; 74 | 75 | const GUID GUID_DEVICE_INTERFACE_STORAGEPORT = { 76 | 0x2ACCFE60L, 0xC130, 0x11D2, { 0xB0, 0x82, 0x00, 0xA0, 0xC9, 0x1E, 0xFB, 0x8B } 77 | }; 78 | 79 | const std::set USB_STORAGE_DRIVERS{ 80 | "USBSTOR", "UASPSTOR", "VUSBSTOR", 81 | "RTUSER", "CMIUCR", "EUCR", 82 | "ETRONSTOR", "ASUSSTPT" 83 | }; 84 | 85 | const std::set GENERIC_STORAGE_DRIVERS{ 86 | "SCSI", "SD", "PCISTOR", 87 | "RTSOR", "JMCR", "JMCF", "RIMMPTSK", "RIMSPTSK", "RIXDPTSK", 88 | "TI21SONY", "ESD7SK", "ESM7SK", "O2MD", "O2SD", "VIACR" 89 | }; 90 | 91 | // List of known virtual disk hardware IDs 92 | const std::set VHD_HARDWARE_IDS{ 93 | "Arsenal_________Virtual_", 94 | "KernSafeVirtual_________", 95 | "Msft____Virtual_Disk____", 96 | "VMware__VMware_Virtual_S" 97 | }; 98 | 99 | const GUID KNOWN_FOLDER_IDS[]{ 100 | FOLDERID_Windows, 101 | FOLDERID_Profile, 102 | FOLDERID_ProgramFiles, 103 | FOLDERID_ProgramFilesX86 104 | }; 105 | 106 | } // namespace Drivelist 107 | 108 | #endif // SRC_WINDOWS_LIST_HPP_ --------------------------------------------------------------------------------