You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.
I noticed that modernstorage does not support creation of directories when AndroidFileSystem#sink(uri, mustCreate = true) is called. Is this something you're planning to support in the future?
FWIW MediaStore.MediaColumns.RELATIVE_PATH can be used for creating directories, but I'm not sure how you'd generalize this to support any directory because it only works if the relative path begins at the root of storage (using Environment.DIRECTORY_*).
Here's an example:
val path:Path= …
context.contentResolver.insert(
MediaStore.Downloads.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY),
contentValuesOf(
MediaStore.MediaColumns.DISPLAY_NAME to path.name,
MediaStore.MediaColumns.RELATIVE_PATH to (Environment.DIRECTORY_DOWNLOADS.toPath() / path.parent!!).toString()
)
)!!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I noticed that
modernstorage
does not support creation of directories whenAndroidFileSystem#sink(uri, mustCreate = true)
is called. Is this something you're planning to support in the future?FWIW MediaStore.MediaColumns.RELATIVE_PATH can be used for creating directories, but I'm not sure how you'd generalize this to support any directory because it only works if the relative path begins at the root of storage (using
Environment.DIRECTORY_*
).Here's an example:
Beta Was this translation helpful? Give feedback.
All reactions