[android-developers] Problem setting file permissions when filename has a space
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.
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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home