~eliasnaur/gio

1

Android: read-only file systsem despite WRITE_EXTERNAL_STORAGE

Details
Message ID
<1142837596.102460.1736469261681@com4.strato.de>
Sender timestamp
1736472861
DKIM signature
pass
Download raw message
Dear Elias and all others,

my attempt to create a directory with os.Mkdir("xxx", os.ModePerm) failed with the message
mkdir xxx: read-only file system

although I managed to set WRITE_EXTERNAL_STORAGE and all possible other permissions by using
a proper import statement like
import ( _ "gioui.org/app/permission/storage" ... ) 

This behaviour is mysterious to me.

How to properly create directories on Android ?

Best,
Otfried
Details
Message ID
<f1005a6a-868e-4bc9-8457-7c5efe555c98@app.fastmail.com>
In-Reply-To
<1142837596.102460.1736469261681@com4.strato.de> (view parent)
Sender timestamp
1736474975
DKIM signature
pass
Download raw message
Can you try use the `DataDir` (https://pkg.go.dev/gioui.org@v0.7.1/app#DataDir) folder, that is exclusive for your app and you can use it.

If you want to read/write outside of the app sandbox you need permission, but the permission need to be performed by the user explicitly, see https://git.sr.ht/~whereswaldon/gio-x/tree/v0.7.1/item/explorer/explorer_android.java#L149-159

-- 
  Lucas Rodrigues
  inkeliz@inkeliz.com

On Fri, Jan 10, 2025, at 12:34 AM, Otfried Geffert wrote:
> Dear Elias and all others,
>
> my attempt to create a directory with os.Mkdir("xxx", os.ModePerm) 
> failed with the message
> mkdir xxx: read-only file system
>
> although I managed to set WRITE_EXTERNAL_STORAGE and all possible other 
> permissions by using
> a proper import statement like
> import ( _ "gioui.org/app/permission/storage" ... ) 
>
> This behaviour is mysterious to me.
>
> How to properly create directories on Android ?
>
> Best,
> Otfried
Reply to thread Export thread (mbox)