Skip to content

Commit

Permalink
[path_provider_windows] Update to ffi 2.0.0 (flutter#5853)
Browse files Browse the repository at this point in the history
* Use Win32 type aliases

* Generated file update

* Bump version

* Bump pub dependency in path_provider_linux

* Add integration_test dev dependency

* Revert "Add integration_test dev dependency"

This reverts commit 40e7778.

* Address review comments
  • Loading branch information
Tim Sneath authored and mvanbeusekom committed Jul 19, 2022
1 parent 4a8bdc5 commit d5c0769
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 16 deletions.
12 changes: 10 additions & 2 deletions packages/path_provider/path_provider_linux/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.1.7

* Bumps ffi dependency to match path_provider_windows.

## 2.1.6

* Fixes library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors
Expand Down Expand Up @@ -54,20 +58,24 @@

* Check in linux/ directory for example/

## 0.1.1 - NOT PUBLISHED
## 0.1.1 - NOT PUBLISHED

* Reverts changes on 0.1.0, which broke the tree.

## 0.1.0 - NOT PUBLISHED

## 0.1.0 - NOT PUBLISHED
* This release updates getApplicationSupportPath to use the application ID instead of the executable name.
* No migration is provided, so any older apps that were using this path will now have a different directory.

## 0.0.1+2

* This release updates the example to depend on the endorsed plugin rather than relative path

## 0.0.1+1

* This updates the readme and pubspec and example to reflect the endorsement of this implementation of `path_provider`

## 0.0.1

* The initial implementation of path\_provider for Linux
* Implements getApplicationSupportPath, getApplicationDocumentsPath, getDownloadsPath, and getTemporaryPath
4 changes: 2 additions & 2 deletions packages/path_provider/path_provider_linux/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: path_provider_linux
description: Linux implementation of the path_provider plugin
repository: https://github.com/flutter/plugins/tree/main/packages/path_provider/path_provider_linux
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+path_provider%22
version: 2.1.6
version: 2.1.7

environment:
sdk: ">=2.12.0 <3.0.0"
Expand All @@ -16,7 +16,7 @@ flutter:
dartPluginClass: PathProviderLinux

dependencies:
ffi: ^1.1.2
ffi: ">=1.1.2 <3.0.0"
flutter:
sdk: flutter
path: ^1.8.0
Expand Down
5 changes: 3 additions & 2 deletions packages/path_provider/path_provider_windows/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 2.0.7
## 2.1.0

* Added support for unicode encoded VERSIONINFO
* Upgrades `package:ffi` dependency to 2.0.0.
* Added support for unicode encoded VERSIONINFO.
* Minor fixes for new analysis options.

## 2.0.6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
list(APPEND FLUTTER_PLUGIN_LIST
)

list(APPEND FLUTTER_FFI_PLUGIN_LIST
)

set(PLUGIN_BUNDLED_LIBRARIES)

foreach(plugin ${FLUTTER_PLUGIN_LIST})
Expand All @@ -13,3 +16,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST})
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin)

foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
endforeach(ffi_plugin)
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class VersionInfoQuerier {
}
final Pointer<Utf16> keyPath =
TEXT('\\StringFileInfo\\$language$encoding\\$key');
final Pointer<Uint32> length = calloc<Uint32>();
final Pointer<UINT> length = calloc<UINT>();
final Pointer<Pointer<Utf16>> valueAddress = calloc<Pointer<Utf16>>();
try {
if (VerQueryValue(versionInfo, keyPath, valueAddress, length) == 0) {
Expand Down Expand Up @@ -192,10 +192,9 @@ class PathProviderWindows extends PathProviderPlatform {
String? companyName;
String? productName;

final Pointer<Utf16> moduleNameBuffer =
calloc<Uint16>(MAX_PATH + 1).cast<Utf16>();
final Pointer<Uint32> unused = calloc<Uint32>();
Pointer<Uint8>? infoBuffer;
final Pointer<Utf16> moduleNameBuffer = wsalloc(MAX_PATH + 1);
final Pointer<DWORD> unused = calloc<DWORD>();
Pointer<BYTE>? infoBuffer;
try {
// Get the module name.
final int moduleNameLength =
Expand All @@ -208,7 +207,7 @@ class PathProviderWindows extends PathProviderPlatform {
// From that, load the VERSIONINFO resource
final int infoSize = GetFileVersionInfoSize(moduleNameBuffer, unused);
if (infoSize != 0) {
infoBuffer = calloc<Uint8>(infoSize);
infoBuffer = calloc<BYTE>(infoSize);
if (GetFileVersionInfo(moduleNameBuffer, 0, infoSize, infoBuffer) ==
0) {
calloc.free(infoBuffer);
Expand Down
8 changes: 4 additions & 4 deletions packages/path_provider/path_provider_windows/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: path_provider_windows
description: Windows implementation of the path_provider plugin
repository: https://github.com/flutter/plugins/tree/main/packages/path_provider/path_provider_windows
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+path_provider%22
version: 2.0.7
version: 2.1.0

environment:
sdk: ">=2.12.0 <3.0.0"
flutter: ">=2.8.0"
sdk: ">=2.17.0 <3.0.0"
flutter: ">=3.0.0"

flutter:
plugin:
Expand All @@ -16,7 +16,7 @@ flutter:
dartPluginClass: PathProviderWindows

dependencies:
ffi: ^1.0.0
ffi: ^2.0.0
flutter:
sdk: flutter
path: ^1.8.0
Expand Down

0 comments on commit d5c0769

Please sign in to comment.