Skip to content

Commit d5c0769

Browse files
Tim Sneathmvanbeusekom
authored andcommitted
[path_provider_windows] Update to ffi 2.0.0 (flutter#5853)
* 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
1 parent 4a8bdc5 commit d5c0769

File tree

6 files changed

+32
-16
lines changed

6 files changed

+32
-16
lines changed

packages/path_provider/path_provider_linux/CHANGELOG.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.1.7
2+
3+
* Bumps ffi dependency to match path_provider_windows.
4+
15
## 2.1.6
26

37
* Fixes library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors
@@ -54,20 +58,24 @@
5458

5559
* Check in linux/ directory for example/
5660

57-
## 0.1.1 - NOT PUBLISHED
61+
## 0.1.1 - NOT PUBLISHED
62+
5863
* Reverts changes on 0.1.0, which broke the tree.
5964

65+
## 0.1.0 - NOT PUBLISHED
6066

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

6570
## 0.0.1+2
71+
6672
* This release updates the example to depend on the endorsed plugin rather than relative path
6773

6874
## 0.0.1+1
75+
6976
* This updates the readme and pubspec and example to reflect the endorsement of this implementation of `path_provider`
7077

7178
## 0.0.1
79+
7280
* The initial implementation of path\_provider for Linux
7381
* Implements getApplicationSupportPath, getApplicationDocumentsPath, getDownloadsPath, and getTemporaryPath

packages/path_provider/path_provider_linux/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: path_provider_linux
22
description: Linux implementation of the path_provider plugin
33
repository: https://github.com/flutter/plugins/tree/main/packages/path_provider/path_provider_linux
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+path_provider%22
5-
version: 2.1.6
5+
version: 2.1.7
66

77
environment:
88
sdk: ">=2.12.0 <3.0.0"
@@ -16,7 +16,7 @@ flutter:
1616
dartPluginClass: PathProviderLinux
1717

1818
dependencies:
19-
ffi: ^1.1.2
19+
ffi: ">=1.1.2 <3.0.0"
2020
flutter:
2121
sdk: flutter
2222
path: ^1.8.0

packages/path_provider/path_provider_windows/CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
## 2.0.7
1+
## 2.1.0
22

3-
* Added support for unicode encoded VERSIONINFO
3+
* Upgrades `package:ffi` dependency to 2.0.0.
4+
* Added support for unicode encoded VERSIONINFO.
45
* Minor fixes for new analysis options.
56

67
## 2.0.6

packages/path_provider/path_provider_windows/example/windows/flutter/generated_plugins.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
list(APPEND FLUTTER_PLUGIN_LIST
66
)
77

8+
list(APPEND FLUTTER_FFI_PLUGIN_LIST
9+
)
10+
811
set(PLUGIN_BUNDLED_LIBRARIES)
912

1013
foreach(plugin ${FLUTTER_PLUGIN_LIST})
@@ -13,3 +16,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST})
1316
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
1417
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
1518
endforeach(plugin)
19+
20+
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
21+
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
22+
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
23+
endforeach(ffi_plugin)

packages/path_provider/path_provider_windows/lib/src/path_provider_windows_real.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class VersionInfoQuerier {
5050
}
5151
final Pointer<Utf16> keyPath =
5252
TEXT('\\StringFileInfo\\$language$encoding\\$key');
53-
final Pointer<Uint32> length = calloc<Uint32>();
53+
final Pointer<UINT> length = calloc<UINT>();
5454
final Pointer<Pointer<Utf16>> valueAddress = calloc<Pointer<Utf16>>();
5555
try {
5656
if (VerQueryValue(versionInfo, keyPath, valueAddress, length) == 0) {
@@ -192,10 +192,9 @@ class PathProviderWindows extends PathProviderPlatform {
192192
String? companyName;
193193
String? productName;
194194

195-
final Pointer<Utf16> moduleNameBuffer =
196-
calloc<Uint16>(MAX_PATH + 1).cast<Utf16>();
197-
final Pointer<Uint32> unused = calloc<Uint32>();
198-
Pointer<Uint8>? infoBuffer;
195+
final Pointer<Utf16> moduleNameBuffer = wsalloc(MAX_PATH + 1);
196+
final Pointer<DWORD> unused = calloc<DWORD>();
197+
Pointer<BYTE>? infoBuffer;
199198
try {
200199
// Get the module name.
201200
final int moduleNameLength =
@@ -208,7 +207,7 @@ class PathProviderWindows extends PathProviderPlatform {
208207
// From that, load the VERSIONINFO resource
209208
final int infoSize = GetFileVersionInfoSize(moduleNameBuffer, unused);
210209
if (infoSize != 0) {
211-
infoBuffer = calloc<Uint8>(infoSize);
210+
infoBuffer = calloc<BYTE>(infoSize);
212211
if (GetFileVersionInfo(moduleNameBuffer, 0, infoSize, infoBuffer) ==
213212
0) {
214213
calloc.free(infoBuffer);

packages/path_provider/path_provider_windows/pubspec.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ name: path_provider_windows
22
description: Windows implementation of the path_provider plugin
33
repository: https://github.com/flutter/plugins/tree/main/packages/path_provider/path_provider_windows
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+path_provider%22
5-
version: 2.0.7
5+
version: 2.1.0
66

77
environment:
8-
sdk: ">=2.12.0 <3.0.0"
9-
flutter: ">=2.8.0"
8+
sdk: ">=2.17.0 <3.0.0"
9+
flutter: ">=3.0.0"
1010

1111
flutter:
1212
plugin:
@@ -16,7 +16,7 @@ flutter:
1616
dartPluginClass: PathProviderWindows
1717

1818
dependencies:
19-
ffi: ^1.0.0
19+
ffi: ^2.0.0
2020
flutter:
2121
sdk: flutter
2222
path: ^1.8.0

0 commit comments

Comments
 (0)