cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Massimiliano Perantoni (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CB-14149) Android usage of cordova.file.dataDirectory does not let save the audio
Date Wed, 20 Jun 2018 07:28:00 GMT
Massimiliano Perantoni created CB-14149:
-------------------------------------------

             Summary: Android usage of cordova.file.dataDirectory does not let save the audio
                 Key: CB-14149
                 URL: https://issues.apache.org/jira/browse/CB-14149
             Project: Apache Cordova
          Issue Type: Bug
          Components: cordova-plugin-media
    Affects Versions: 5.0.1
            Reporter: Massimiliano Perantoni


Hello, due to a difference between mount points I think, the call to

{color:#000080}public void {color}moveFile(String file) {

after recording fails due to the impossibility of moving data from the tmp save to the final
destination, as

f.renameTo fails

I replaced the f.renameTo with other code

 
{code:java}
try {
 File f = new File(this.tempFile);
 File fileOut = new File(file);
 fileOut.createNewFile();
 Reader in = new FileReader(f);
 Writer out = new FileWriter(fileOut);
 IOUtils.copy(in,out);
 in.close();
 out.close();
 f.delete();
} catch (IOException e) {
 e.printStackTrace();
}
//if (!f.renameTo()) LOG.e(LOG_TAG, "FAILED " + logMsg);{code}
It seems to work properly, and is more generic, even if I had to add IOUtils ad dependency
to use it (it can be even without, but there's more code).

If you prefer, I can join and patch the code with this, just to contribute.

Hope it helps

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message