forked from github/cordova-android
more file:// URI truncation :D
This commit is contained in:
parent
7c1eb7da9b
commit
d6fef8d6e3
@ -975,6 +975,10 @@ public class FileUtils extends Plugin {
|
|||||||
*/
|
*/
|
||||||
/**/
|
/**/
|
||||||
public long write(String filename, String data, int offset) throws FileNotFoundException, IOException {
|
public long write(String filename, String data, int offset) throws FileNotFoundException, IOException {
|
||||||
|
if (filename.startsWith("file://")) {
|
||||||
|
filename = filename.substring(7);
|
||||||
|
}
|
||||||
|
|
||||||
boolean append = false;
|
boolean append = false;
|
||||||
if (offset > 0) {
|
if (offset > 0) {
|
||||||
this.truncateFile(filename, offset);
|
this.truncateFile(filename, offset);
|
||||||
@ -1001,6 +1005,10 @@ public class FileUtils extends Plugin {
|
|||||||
* @throws FileNotFoundException, IOException
|
* @throws FileNotFoundException, IOException
|
||||||
*/
|
*/
|
||||||
private long truncateFile(String filename, long size) throws FileNotFoundException, IOException {
|
private long truncateFile(String filename, long size) throws FileNotFoundException, IOException {
|
||||||
|
if (filename.startsWith("file://")) {
|
||||||
|
filename = filename.substring(7);
|
||||||
|
}
|
||||||
|
|
||||||
RandomAccessFile raf = new RandomAccessFile(filename, "rw");
|
RandomAccessFile raf = new RandomAccessFile(filename, "rw");
|
||||||
|
|
||||||
if (raf.length() >= size) {
|
if (raf.length() >= size) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user