Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLC-iOS
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
310
Issues
310
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VideoLAN
VLC-iOS
Commits
f7374647
Commit
f7374647
authored
May 20, 2013
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
URL handling: add error handling and behave correctly when saving files
parent
10c9d0e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
AspenProject/VLCAppDelegate.m
AspenProject/VLCAppDelegate.m
+6
-5
No files found.
AspenProject/VLCAppDelegate.m
View file @
f7374647
...
...
@@ -43,7 +43,7 @@
if
(
_playlistViewController
&&
url
!=
nil
)
{
APLog
(
@"%@ requested %@ to be opened"
,
sourceApplication
,
url
);
if
(
url
.
isFileURL
||
[
url
.
scheme
isEqualToString
:
@"http"
]
||
[
url
.
scheme
isEqualToString
:
@"https"
]
)
{
if
(
url
.
isFileURL
)
{
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
NSLocalizedString
(
@"SAVE_FILE"
,
@""
)
message
:[
NSString
stringWithFormat
:
NSLocalizedString
(
@"SAVE_FILE_LONG"
,
@""
),
url
.
lastPathComponent
]
delegate
:
self
cancelButtonTitle
:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
@""
)
otherButtonTitles
:
NSLocalizedString
(
@"BUTTON_SAVE"
,
@""
),
nil
];
_tempURL
=
url
;
[
alert
show
];
...
...
@@ -59,14 +59,15 @@
if
(
buttonIndex
==
1
)
{
NSArray
*
searchPaths
=
NSSearchPathForDirectoriesInDomains
(
NSDocumentDirectory
,
NSUserDomainMask
,
YES
);
NSString
*
directoryPath
=
searchPaths
[
0
];
NSURL
*
destinationURL
=
[
NSURL
URLWithString
:[
NSString
stringWithFormat
:
@"file://
%@/%@"
,
directoryPath
,
_tempURL
.
lastPathComponent
]];
NSURL
*
destinationURL
=
[
NSURL
fileURLWithPath
:[
NSString
stringWithFormat
:
@"
%@/%@"
,
directoryPath
,
_tempURL
.
lastPathComponent
]];
NSError
*
theError
;
[[
NSFileManager
defaultManager
]
copyItemAtURL
:
_tempURL
toURL
:
destinationURL
error
:&
theError
];
if
(
theError
.
code
!=
noErr
)
APLog
(
@"saving the file failed (%i): %@"
,
theError
.
code
,
theError
.
localizedDescription
);
[
self
updateMediaList
];
}
[
_playlistViewController
openMovieFromURL
:
_tempURL
];
}
else
[
_playlistViewController
openMovieFromURL
:
_tempURL
];
}
-
(
void
)
applicationWillResignActive
:(
UIApplication
*
)
application
...
...
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