Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Casanowow Life for love
VLC-Android
Commits
bd9f84f7
Commit
bd9f84f7
authored
Mar 02, 2018
by
Geoffrey Métais
Browse files
File deletion: prevent crash
Also, normal delete method for pre-Lollipop devices
parent
fd411dbd
Changes
1
Hide whitespace changes
Inline
Side-by-side
vlc-android/src/org/videolan/vlc/util/FileUtils.java
View file @
bd9f84f7
...
...
@@ -210,10 +210,13 @@ public class FileUtils {
}
return
ret
;
}
public
static
boolean
deleteFile
(
Uri
uri
){
if
(
uri
.
getPath
().
startsWith
(
AndroidDevices
.
EXTERNAL_PUBLIC_DIRECTORY
))
return
deleteFile
(
uri
.
getPath
());
public
static
boolean
deleteFile
(
Uri
uri
)
{
if
(
!
AndroidUtil
.
isLolliPopOrLater
||
uri
.
getPath
().
startsWith
(
AndroidDevices
.
EXTERNAL_PUBLIC_DIRECTORY
))
return
deleteFile
(
uri
.
getPath
());
final
DocumentFile
docFile
=
FileUtils
.
findFile
(
uri
);
return
docFile
!=
null
&&
docFile
.
delete
();
if
(
docFile
!=
null
)
try
{
return
docFile
.
delete
();
}
catch
(
Exception
ignored
)
{}
return
false
;
}
@TargetApi
(
Build
.
VERSION_CODES
.
HONEYCOMB
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment