Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Ewout ter Hoeven
VLC-Android
Commits
dba74527
Commit
dba74527
authored
May 20, 2015
by
Geoffrey Métais
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix deleteFile Util method
parent
cc91cf19
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
10 deletions
+6
-10
vlc-android/src/org/videolan/vlc/util/Util.java
vlc-android/src/org/videolan/vlc/util/Util.java
+6
-10
No files found.
vlc-android/src/org/videolan/vlc/util/Util.java
View file @
dba74527
...
...
@@ -317,21 +317,17 @@ public class Util {
@TargetApi
(
Build
.
VERSION_CODES
.
HONEYCOMB
)
public
static
boolean
deleteFile
(
Context
context
,
String
path
){
boolean
deleted
=
false
;
if
(
path
.
startsWith
(
"file://"
))
path
=
path
.
substring
(
5
);
else
return
deleted
;
path
=
Uri
.
decode
(
Strings
.
removeFileProtocole
(
path
));
//Delete from Android Medialib, for consistency with device MTP storing and other apps listing content:// media
if
(
LibVlcUtil
.
isHoneycombOrLater
()){
ContentResolver
cr
=
context
.
getContentResolver
();
String
[]
selectionArgs
=
{
path
};
deleted
=
cr
.
delete
(
MediaStore
.
Files
.
getContentUri
(
"external"
),
MediaStore
.
MediaColumns
.
DATA
+
"=?"
,
selectionArgs
)
>
0
;
}
if
(!
deleted
){
File
file
=
new
File
(
Uri
.
decode
(
path
));
if
(
file
.
exists
())
deleted
=
file
.
delete
();
MediaStore
.
Files
.
FileColumns
.
DATA
+
"=?"
,
selectionArgs
)
>
0
;
}
File
file
=
new
File
(
path
);
if
(
file
.
exists
())
deleted
|=
file
.
delete
();
return
deleted
;
}
...
...
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