I have put an answer in the SO question. In a nutshell, don't put them
in the cache dir. Use openFileOutput() and set MODE_WORLD_READABLE.

On Sat, Apr 23, 2011 at 11:43 AM, Paul <[email protected]> wrote:
> I have a question over at StackOverflow that's been sitting there for
> over a month, and wondered if maybe someone here (or a Googlite) could
> answer it.
>
> http://stackoverflow.com/questions/5149739/android-problem-setting-file-permissions-when-filename-has-a-space
>
> I have an app where I store .png images in the app's cache directory,
> and as I am sharing these files via messaging, etc, I need to make the
> files readable temporarily by everyone (i.e. chmod 755).
>
> As suggested in another thread, I am running Runtime.getRuntime.exec()
> to do this:
>
> Runtime.getRuntime().exec("setperm chmod 755 /path/to/filename.png");
>
> This works fine, and as I am filtering / and \, any name works...
> except a name with a space, unsurpisingly. This fails:
>
> Runtime.getRuntime().exec("setperm chmod 755 /path/to/file name.png");
>
> So, coming from linux, I try wrapping the file path in quotes, which
> works on linux, but still fails to change the file perms on Android:
>
> Runtime.getRuntime().exec("setperm chmod 755 \"/path/to/file name.png
> \"");
> or
> Runtime.getRuntime().exec("setperm chmod 755 '/path/to/file
> name.png'");
>
> Any ideas?
>
> Thanks,
>
> Paul
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android 3.0 Programming Books: http://commonsware.com/books

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to