From 02e2e59d542bb6b0d39fb76aebcdbe6fd5aeebf0 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Fri, 24 Jul 2020 10:54:15 -0700 Subject: [PATCH 1/3] Revert "[path_provider] Use the application ID in the application support path (#2845)" This reverts commit 7d4a918be3e682104807cc70ba41d6e27a01248e. --- .../path_provider_linux/CHANGELOG.md | 4 -- .../lib/path_provider_linux.dart | 48 ++----------------- .../path_provider_linux/pubspec.yaml | 3 +- 3 files changed, 4 insertions(+), 51 deletions(-) diff --git a/packages/path_provider/path_provider_linux/CHANGELOG.md b/packages/path_provider/path_provider_linux/CHANGELOG.md index 2b95b38b9c59..e0155d3b3e83 100644 --- a/packages/path_provider/path_provider_linux/CHANGELOG.md +++ b/packages/path_provider/path_provider_linux/CHANGELOG.md @@ -1,7 +1,3 @@ -## 0.1.0 -* 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 diff --git a/packages/path_provider/path_provider_linux/lib/path_provider_linux.dart b/packages/path_provider/path_provider_linux/lib/path_provider_linux.dart index 9441f6ea5f5d..09d2447c0a6c 100644 --- a/packages/path_provider/path_provider_linux/lib/path_provider_linux.dart +++ b/packages/path_provider/path_provider_linux/lib/path_provider_linux.dart @@ -3,21 +3,11 @@ // found in the LICENSE file. import 'dart:io'; import 'dart:async'; -import 'dart:ffi'; -import 'package:ffi/ffi.dart'; import 'package:xdg_directories/xdg_directories.dart' as xdg; import 'package:path/path.dart' as path; import 'package:path_provider_platform_interface/path_provider_platform_interface.dart'; -// GApplication* g_application_get_default(); -typedef g_application_get_default_c = IntPtr Function(); -typedef g_application_get_default_dart = int Function(); - -// const gchar* g_application_get_application_id(GApplication* application); -typedef g_application_get_application_id_c = Pointer Function(IntPtr); -typedef g_application_get_application_id_dart = Pointer Function(int); - /// The linux implementation of [PathProviderPlatform] /// /// This class implements the `package:path_provider` functionality for linux @@ -32,43 +22,11 @@ class PathProviderLinux extends PathProviderPlatform { return Future.value("/tmp"); } - // Gets the application ID set in GApplication. - String _getApplicationId() { - DynamicLibrary gio; - try { - gio = DynamicLibrary.open('libgio-2.0.so'); - } on ArgumentError { - return null; - } - var g_application_get_default = gio.lookupFunction< - g_application_get_default_c, - g_application_get_default_dart>('g_application_get_default'); - var app = g_application_get_default(); - if (app == 0) return null; - - var g_application_get_application_id = gio.lookupFunction< - g_application_get_application_id_c, - g_application_get_application_id_dart>( - 'g_application_get_application_id'); - var app_id = g_application_get_application_id(app); - if (app_id == null) return null; - - return Utf8.fromUtf8(app_id); - } - - // Gets the unique ID for this application. - Future _getId() async { - var appId = _getApplicationId(); - if (appId != null) return appId; - - // Fall back to using the executable name. - return path.basenameWithoutExtension( - await File('/proc/self/exe').resolveSymbolicLinks()); - } - @override Future getApplicationSupportPath() async { - final directory = Directory(path.join(xdg.dataHome.path, await _getId())); + final processName = path.basenameWithoutExtension( + await File('/proc/self/exe').resolveSymbolicLinks()); + final directory = Directory(path.join(xdg.dataHome.path, processName)); // Creating the directory if it doesn't exist, because mobile implementations assume the directory exists if (!await directory.exists()) { await directory.create(recursive: true); diff --git a/packages/path_provider/path_provider_linux/pubspec.yaml b/packages/path_provider/path_provider_linux/pubspec.yaml index a6d48bfa59aa..67c4ae6ae943 100644 --- a/packages/path_provider/path_provider_linux/pubspec.yaml +++ b/packages/path_provider/path_provider_linux/pubspec.yaml @@ -1,6 +1,6 @@ name: path_provider_linux description: linux implementation of the path_provider plugin -version: 0.1.0 +version: 0.0.1+2 homepage: https://github.com/flutter/plugins/tree/master/packages/path_provider/path_provider_linux flutter: @@ -15,7 +15,6 @@ environment: flutter: ">=1.10.0 <2.0.0" dependencies: - ffi: ^0.1.3 path: ^1.6.4 xdg_directories: ^0.1.0 path_provider_platform_interface: ^1.0.1 From 630b6b5a0d781fa5d59283fbe3c82afe197eac73 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Fri, 24 Jul 2020 11:25:31 -0700 Subject: [PATCH 2/3] bump version :( --- .../path_provider/path_provider_linux/CHANGELOG.md | 10 +++++++++- .../path_provider/path_provider_linux/pubspec.yaml | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/path_provider/path_provider_linux/CHANGELOG.md b/packages/path_provider/path_provider_linux/CHANGELOG.md index e0155d3b3e83..baec603b426f 100644 --- a/packages/path_provider/path_provider_linux/CHANGELOG.md +++ b/packages/path_provider/path_provider_linux/CHANGELOG.md @@ -1,3 +1,11 @@ +## 0.1.1 - NOT PUBLISHED +* Reverts changes on 0.1.0, which broke the tree. + + +## 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 @@ -7,4 +15,4 @@ ## 0.0.1 * The initial implementation of path_provider for Linux * Implements getApplicationSupportPath, getApplicationDocumentsPath, getDownloadsPath, and getTemporaryPath - + diff --git a/packages/path_provider/path_provider_linux/pubspec.yaml b/packages/path_provider/path_provider_linux/pubspec.yaml index 67c4ae6ae943..b0188fd2a4c7 100644 --- a/packages/path_provider/path_provider_linux/pubspec.yaml +++ b/packages/path_provider/path_provider_linux/pubspec.yaml @@ -1,6 +1,6 @@ name: path_provider_linux description: linux implementation of the path_provider plugin -version: 0.0.1+2 +version: 0.1.1 homepage: https://github.com/flutter/plugins/tree/master/packages/path_provider/path_provider_linux flutter: From c7386813dd31ffebc84ebd0e04033c0f25e4d839 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Fri, 24 Jul 2020 11:49:24 -0700 Subject: [PATCH 3/3] .. --- packages/path_provider/path_provider/CHANGELOG.md | 4 ++++ .../android/app/src/androidTest/java/MainActivityTest.java | 2 +- packages/path_provider/path_provider/pubspec.yaml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/path_provider/path_provider/CHANGELOG.md b/packages/path_provider/path_provider/CHANGELOG.md index 226d9ae01d0c..07c82ca83b2a 100644 --- a/packages/path_provider/path_provider/CHANGELOG.md +++ b/packages/path_provider/path_provider/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.6.12 + +* Fixed a Java lint in a test. + ## 1.6.11 * Updated documentation to reflect the need for changes in testing for federated plugins diff --git a/packages/path_provider/path_provider/example/android/app/src/androidTest/java/MainActivityTest.java b/packages/path_provider/path_provider/example/android/app/src/androidTest/java/MainActivityTest.java index 25ee8d8fcdc0..5c37b59bf25a 100644 --- a/packages/path_provider/path_provider/example/android/app/src/androidTest/java/MainActivityTest.java +++ b/packages/path_provider/path_provider/example/android/app/src/androidTest/java/MainActivityTest.java @@ -8,7 +8,7 @@ import org.junit.runner.RunWith; @RunWith(FlutterRunner.class) -public class FlutterActivityTest { +public class MainActivityTest { @Rule public ActivityTestRule rule = new ActivityTestRule<>(FlutterActivity.class); } diff --git a/packages/path_provider/path_provider/pubspec.yaml b/packages/path_provider/path_provider/pubspec.yaml index d83911ddc2a8..db2da41d40c2 100644 --- a/packages/path_provider/path_provider/pubspec.yaml +++ b/packages/path_provider/path_provider/pubspec.yaml @@ -2,7 +2,7 @@ name: path_provider description: Flutter plugin for getting commonly used locations on the Android & iOS file systems, such as the temp and app data directories. homepage: https://github.com/flutter/plugins/tree/master/packages/path_provider/path_provider -version: 1.6.11 +version: 1.6.12 flutter: plugin: