Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add missing entitlement to macOS example
  • Loading branch information
stuartmorgan-g committed Feb 19, 2021
commit cb3d0c12ab08e092942468c89590d7870e4dde3e
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,15 @@ void main() {
testWidgets('getDownloadsDirectory', (WidgetTester tester) async {
final PathProviderPlatform provider = PathProviderPlatform.instance;
final String result = await provider.getDownloadsPath();
// Create if necessary, since the native implementation doesn't guarantee
// that the folder exists.
_verifySampleFile(result, 'downloads', createDirectory: true);
_verifySampleFile(result, 'downloads');
});
}

/// Verify a file called [name] in [directoryPath] by recreating it with test
/// contents when necessary.
///
/// If [createDirectory] is true, the directory will be created if missing.
void _verifySampleFile(
String directoryPath,
String name, {
bool createDirectory = false,
}) {
void _verifySampleFile(String directoryPath, String name) {
final Directory directory = Directory(directoryPath);
final File file = File('${directory.path}${Platform.pathSeparator}$name');

Expand All @@ -62,10 +56,6 @@ void _verifySampleFile(
expect(file.existsSync(), isFalse);
}

if (createDirectory) {
directory.createSync(recursive: true);
}

file.writeAsStringSync('Hello world!');
expect(file.readAsStringSync(), 'Hello world!');
expect(directory.listSync(), isNotEmpty);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
<true/>
<key>com.apple.security.network.server</key>
<true/>
<key>com.apple.security.files.downloads.read-write</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.downloads.read-write</key>
<true/>
</dict>
</plist>