mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 21:55:48 +03:00
Fix sd card stuff
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
158b12df71
commit
fc3e981fe7
1 changed files with 22 additions and 2 deletions
|
@ -414,8 +414,28 @@ public class UploadFileOperation extends SyncOperation {
|
|||
throw new OperationCancelledException();
|
||||
}
|
||||
|
||||
FileChannel channel = new RandomAccessFile(mFile.getStoragePath(), "rw").getChannel();
|
||||
fileLock = channel.tryLock();
|
||||
FileChannel channel = null;
|
||||
try {
|
||||
channel = new RandomAccessFile(mFile.getStoragePath(), "rw").getChannel();
|
||||
fileLock = channel.tryLock();
|
||||
} catch (FileNotFoundException e) {
|
||||
if (temporalFile == null) {
|
||||
String temporalPath = FileStorageUtils.getTemporalPath(mAccount.name) + mFile.getRemotePath();
|
||||
mFile.setStoragePath(temporalPath);
|
||||
temporalFile = new File(temporalPath);
|
||||
|
||||
result = copy(originalFile, temporalFile);
|
||||
if (result != null) {
|
||||
return result;
|
||||
} else {
|
||||
channel = new RandomAccessFile(temporalFile.getAbsolutePath(), "rw").getChannel();
|
||||
fileLock = channel.tryLock();
|
||||
}
|
||||
} else {
|
||||
channel = new RandomAccessFile(temporalFile.getAbsolutePath(), "rw").getChannel();
|
||||
fileLock = channel.tryLock();
|
||||
}
|
||||
}
|
||||
|
||||
result = mUploadOperation.execute(client);
|
||||
|
||||
|
|
Loading…
Reference in a new issue