Skip to content

[@capacitor/filesystem] Add support for a directory for SDCard as Portable Storage #36

@ghenry22

Description

@ghenry22

Feature Request

Plugin

filesystem

Description

Currently there is no way to access the SDCard if it is configured as portable storage. None of the existing directory enums reference the SDCard path.

It is possible to get the path to the SDCard using the cordova plugin diagnostic / external storage module and use it as a full URI passed as the path parameter but this means a lot of IF statements or using full path URI's for everything.

Platform(s)

Android

Preferred Solution

Look at the cordova-plugin-diagnostic / external storage module (https://github.com/dpa99c/cordova-diagnostic-plugin/blob/master/src/android/Diagnostic_External_Storage.java).

Incorporate the same logic to get the SDCard details into the filesystem plugin.

Expose the SDCard as a Directory enum called PortableStorage (this is consistent with other directory naming schemes and correct as it references only SDCards configured as Portable Storage vs adopted internal storage).

Having access to the SDCard filesystem on Android should be a core feature of a filesystem plugin.

Alternatives

use the cordova plugin diagnostic / external storage module to get the full path URI to the SDCard
use the filesystem plugin with PATH only using the full URI

This is annoying as it means an additional Cordova plugin is required and forces you to use the Filesystem plugin with full path URI's instead of the directory / path format that can be used with the built in directory enums.

Additional Context

See preferred solution for suggested fix. Use the android 6+ solution from the diagnostic plugin to get the SDcard path and expose as PortableStorage directory enum.

Potentially need a isPortableStorageAvailable or similar simple check to see if a SDCard is detected before using the PortableStorage enum.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions