android - Copying file from subfolder in asset folder -


am trying copy file named subfolder in asset folder getting "not found error" when trying use file. apparently seems not copying file right.

here have done maybe can spot error

method call:

copyfile("/lollipop/proxy.sh"); 

method:

    public void copyfile(string file) {             string of = file;          file f = new file(of);             string basedir = getbasecontext().getfilesdir().getabsolutepath();           if (!f.exists()) {                             try {         inputstream in =getassets().open(file);         fileoutputstream out =getbasecontext().openfileoutput(of, mode_private);        byte[] buf = new byte[1024];         int len;      while ((len = in.read(buf)) > 0) {                  out.write(buf, 0, len);                }             out.close();            in.close();    runtime.getruntime().exec("chmod 700 " + basedir + "/" + of);                     } catch (ioexception e) {                                 log.e(tag, "error reading i/0 stream", e);                             }                         }                     } 

trying use proxy.sh fails file seems it's never copied when remove " lollipop " directory works fine. seems wrong? tnx

openfileoutput() not accept subdirectories. since of points /lollipop/proxy.sh, trying create subdirectory.


Comments