mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-07-23 17:39:42 +02:00
Fix PathAccessException on secondary profiles (#1754)
This commit is contained in:
@@ -743,6 +743,10 @@ class AppsProvider with ChangeNotifier {
|
|||||||
return installed;
|
return installed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<String> getStorageRootPath() async {
|
||||||
|
return '/${(await getExternalStorageDirectory())!.uri.pathSegments.sublist(0, 3).join('/')}';
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> moveObbFile(File file, String appId) async {
|
Future<void> moveObbFile(File file, String appId) async {
|
||||||
if (!file.path.toLowerCase().endsWith('.obb')) return;
|
if (!file.path.toLowerCase().endsWith('.obb')) return;
|
||||||
|
|
||||||
@@ -751,7 +755,7 @@ class AppsProvider with ChangeNotifier {
|
|||||||
await Permission.storage.request();
|
await Permission.storage.request();
|
||||||
}
|
}
|
||||||
|
|
||||||
String obbDirPath = "/storage/emulated/0/Android/obb/$appId";
|
String obbDirPath = "${await getStorageRootPath()}/Android/obb/$appId";
|
||||||
Directory(obbDirPath).createSync(recursive: true);
|
Directory(obbDirPath).createSync(recursive: true);
|
||||||
|
|
||||||
String obbFileName = file.path.split("/").last;
|
String obbFileName = file.path.split("/").last;
|
||||||
@@ -1045,10 +1049,11 @@ class AppsProvider with ChangeNotifier {
|
|||||||
Future<void> downloadFn(MapEntry<String, String> fileUrl, App app) async {
|
Future<void> downloadFn(MapEntry<String, String> fileUrl, App app) async {
|
||||||
try {
|
try {
|
||||||
var exportDir = await settingsProvider.getExportDir();
|
var exportDir = await settingsProvider.getExportDir();
|
||||||
String downloadPath = '/storage/emulated/0/Download';
|
String downloadPath = '${await getStorageRootPath()}/Download';
|
||||||
bool downloadsAccessible = false;
|
bool downloadsAccessible = false;
|
||||||
try {
|
try {
|
||||||
downloadsAccessible = Directory(downloadPath).existsSync();
|
Directory(downloadPath).listSync();
|
||||||
|
downloadsAccessible = true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user