hpoul / file_picker_writable

Flutter plugin to choose files which can be read, referenced and written back at a later time.
https://pub.dev/packages/file_picker_writable
MIT License
17 stars 13 forks source link

[IOS] skipDestinationStartAccess warning #40

Open ahmtydn opened 1 year ago

ahmtydn commented 1 year ago

Warning: startAccessingSecurityScopedResource is false for file:///private/var/mobile/Containers/Shared/AppGroup/A33CEDC8-AC01-4799-B622-684C1CB35B11/File%20Provider%20Storage/data.xlsx (destination); skipDestinationStartAccess=true

Why am I getting the warning? And why are you abbreviating this filename? Can you remove the abbreviation in this filename and release a new version? I removed it manually but I don't want it to break in any pubscpec process.

  Future<T> _createFileInNewTempDirectory<T>(
      String baseName, Future<T> Function(File tempFile) callback) async {

-     if (baseName.length > 30) {
-       baseName = baseName.substring(0, 30);
-     }

    final tempDirBase = await getTemporaryDirectory();

    final tempDir = await tempDirBase.createTemp('file_picker_writable');
    await tempDir.create(recursive: true);
    final tempFile = File(path.join(
      tempDir.path,
      baseName,
    ));
    try {
      return await callback(tempFile);
    } finally {
      _unawaited(tempDir
          .delete(recursive: true)
          .catchError((dynamic error, StackTrace stackTrace) {
        _logger.warning('Error while deleting temp dir.', error, stackTrace);
      }));
    }
  }
}