-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
78 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import 'package:file_picker/file_picker.dart'; | ||
import 'package:file_selector/file_selector.dart' as file_selector; | ||
import 'package:flutter/material.dart'; | ||
import 'package:localsend_app/util/native/platform_check.dart'; | ||
|
||
/// Opens a file picker to select a directory. | ||
/// Returns null if the user cancels the selection. | ||
Future<String?> pickDirectoryPath() async { | ||
if (checkPlatform([TargetPlatform.android])) { | ||
/// We need to use the file_picker package because file_selector does not expose the raw path. | ||
/// We need the raw path to properly manipulate the path to save new files, or | ||
/// to list files recursively. | ||
/// https://github.com/miguelpruivo/flutter_file_picker/issues/1282 | ||
return await FilePicker.platform.getDirectoryPath(); | ||
} else { | ||
return await file_selector.getDirectoryPath(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters