Reputation: 1
For the purposes of this, say I had an Image on my SDcard. I'm looking for a way to copy this to the System/App directory, but cannot for the life of me figure out how to reference the directory. I have got SU permissions from the app, so that isn't the problem. Does anyone know how this can be done? Or how I can reference the system directory?
Also I heard somewhere that I have to mount the System for read and write? How would I safely go about doing this?
I've tried some InputStream and OutputStream IO using "\\system\\app\\file.png" or "system/app/file.png", but non seem to work.
Thanks in advance
Upvotes: 0
Views: 140
Reputation: 2770
Typically /system partition is mounted read-only and you need to remount it first
mount -o remount,rw /system
I'm not sure about doing it "safely", writable /system is inherently unsafe, there is no way to do anything safely after that. But then again if you are running an application with root permissions, safety is out of question already.
Upvotes: 1
Reputation: 1194
You can copy a file from the specified location using Enivronment.getExternalStorageDirectory(). From this line you will get the root of the directory structure and now you can navigate to predefined path as per your wish..
e.g., File root = Environment.getExternalStorageDirectory();
also you can use IOUtils.copy(inputStream, outputStream); to copy from an inputsream (your png file) to an outputstream (where you want to save it).
Upvotes: 1