Skip to content

Commit f860cb4

Browse files
dnfieldEgor
authored and
Egor
committed
Revert "[path_provider] Use the application ID in the application support path" (flutter#2896)
* Revert "[path_provider] Use the application ID in the application support path (flutter#2845)" This reverts commit 7d4a918. * bump version to satisfy the machine. Also fix linting issue caught because of changes in this folder.
1 parent 1170396 commit f860cb4

File tree

6 files changed

+16
-51
lines changed

6 files changed

+16
-51
lines changed

packages/path_provider/path_provider/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.6.12
2+
3+
* Fixed a Java lint in a test.
4+
15
## 1.6.11
26
* Updated documentation to reflect the need for changes in testing for federated plugins
37

packages/path_provider/path_provider/example/android/app/src/androidTest/java/MainActivityTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import org.junit.runner.RunWith;
99

1010
@RunWith(FlutterRunner.class)
11-
public class FlutterActivityTest {
11+
public class MainActivityTest {
1212
@Rule
1313
public ActivityTestRule<FlutterActivity> rule = new ActivityTestRule<>(FlutterActivity.class);
1414
}

packages/path_provider/path_provider/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: path_provider
22
description: Flutter plugin for getting commonly used locations on the Android &
33
iOS file systems, such as the temp and app data directories.
44
homepage: https://github.com/flutter/plugins/tree/master/packages/path_provider/path_provider
5-
version: 1.6.11
5+
version: 1.6.12
66

77
flutter:
88
plugin:

packages/path_provider/path_provider_linux/CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
## 0.1.0
1+
## 0.1.1 - NOT PUBLISHED
2+
* Reverts changes on 0.1.0, which broke the tree.
3+
4+
5+
## 0.1.0 - NOT PUBLISHED
26
* This release updates getApplicationSupportPath to use the application ID instead of the executable name.
37
* No migration is provided, so any older apps that were using this path will now have a different directory.
48

@@ -11,4 +15,4 @@
1115
## 0.0.1
1216
* The initial implementation of path_provider for Linux
1317
* Implements getApplicationSupportPath, getApplicationDocumentsPath, getDownloadsPath, and getTemporaryPath
14-
18+

packages/path_provider/path_provider_linux/lib/path_provider_linux.dart

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,11 @@
33
// found in the LICENSE file.
44
import 'dart:io';
55
import 'dart:async';
6-
import 'dart:ffi';
7-
import 'package:ffi/ffi.dart';
86

97
import 'package:xdg_directories/xdg_directories.dart' as xdg;
108
import 'package:path/path.dart' as path;
119
import 'package:path_provider_platform_interface/path_provider_platform_interface.dart';
1210

13-
// GApplication* g_application_get_default();
14-
typedef g_application_get_default_c = IntPtr Function();
15-
typedef g_application_get_default_dart = int Function();
16-
17-
// const gchar* g_application_get_application_id(GApplication* application);
18-
typedef g_application_get_application_id_c = Pointer<Utf8> Function(IntPtr);
19-
typedef g_application_get_application_id_dart = Pointer<Utf8> Function(int);
20-
2111
/// The linux implementation of [PathProviderPlatform]
2212
///
2313
/// This class implements the `package:path_provider` functionality for linux
@@ -32,43 +22,11 @@ class PathProviderLinux extends PathProviderPlatform {
3222
return Future.value("/tmp");
3323
}
3424

35-
// Gets the application ID set in GApplication.
36-
String _getApplicationId() {
37-
DynamicLibrary gio;
38-
try {
39-
gio = DynamicLibrary.open('libgio-2.0.so');
40-
} on ArgumentError {
41-
return null;
42-
}
43-
var g_application_get_default = gio.lookupFunction<
44-
g_application_get_default_c,
45-
g_application_get_default_dart>('g_application_get_default');
46-
var app = g_application_get_default();
47-
if (app == 0) return null;
48-
49-
var g_application_get_application_id = gio.lookupFunction<
50-
g_application_get_application_id_c,
51-
g_application_get_application_id_dart>(
52-
'g_application_get_application_id');
53-
var app_id = g_application_get_application_id(app);
54-
if (app_id == null) return null;
55-
56-
return Utf8.fromUtf8(app_id);
57-
}
58-
59-
// Gets the unique ID for this application.
60-
Future<String> _getId() async {
61-
var appId = _getApplicationId();
62-
if (appId != null) return appId;
63-
64-
// Fall back to using the executable name.
65-
return path.basenameWithoutExtension(
66-
await File('/proc/self/exe').resolveSymbolicLinks());
67-
}
68-
6925
@override
7026
Future<String> getApplicationSupportPath() async {
71-
final directory = Directory(path.join(xdg.dataHome.path, await _getId()));
27+
final processName = path.basenameWithoutExtension(
28+
await File('/proc/self/exe').resolveSymbolicLinks());
29+
final directory = Directory(path.join(xdg.dataHome.path, processName));
7230
// Creating the directory if it doesn't exist, because mobile implementations assume the directory exists
7331
if (!await directory.exists()) {
7432
await directory.create(recursive: true);

packages/path_provider/path_provider_linux/pubspec.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: path_provider_linux
22
description: linux implementation of the path_provider plugin
3-
version: 0.1.0
3+
version: 0.1.1
44
homepage: https://github.com/flutter/plugins/tree/master/packages/path_provider/path_provider_linux
55

66
flutter:
@@ -15,7 +15,6 @@ environment:
1515
flutter: ">=1.10.0 <2.0.0"
1616

1717
dependencies:
18-
ffi: ^0.1.3
1918
path: ^1.6.4
2019
xdg_directories: ^0.1.0
2120
path_provider_platform_interface: ^1.0.1

0 commit comments

Comments
 (0)