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
Steve Lhomme
VLC
Commits
34174cd2
Commit
34174cd2
authored
Feb 14, 2014
by
François Cartegnie
🤞
Browse files
playlist: indirectly write when exporting to ml.xspf
parent
e7847d8d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/playlist/loadsave.c
View file @
34174cd2
...
...
@@ -182,19 +182,19 @@ int playlist_MLLoad( playlist_t *p_playlist )
int
playlist_MLDump
(
playlist_t
*
p_playlist
)
{
char
*
psz_
datadir
;
char
*
psz_
temp
;
psz_
datadir
=
config_GetUserDir
(
VLC_DATA_DIR
);
psz_
temp
=
config_GetUserDir
(
VLC_DATA_DIR
);
if
(
!
psz_
datadir
)
/* XXX: This should never happen */
if
(
!
psz_
temp
)
/* XXX: This should never happen */
{
msg_Err
(
p_playlist
,
"no data directory, cannot save media library"
)
;
return
VLC_EGENERIC
;
}
char
psz_dirname
[
strlen
(
psz_
datadir
)
+
sizeof
(
DIR_SEP
"ml.xspf"
)];
strcpy
(
psz_dirname
,
psz_
datadir
);
free
(
psz_
datadir
);
char
psz_dirname
[
strlen
(
psz_
temp
)
+
sizeof
(
DIR_SEP
"ml.xspf"
)];
strcpy
(
psz_dirname
,
psz_
temp
);
free
(
psz_
temp
);
if
(
config_CreateDir
(
(
vlc_object_t
*
)
p_playlist
,
psz_dirname
)
)
{
return
VLC_EGENERIC
;
...
...
@@ -202,8 +202,25 @@ int playlist_MLDump( playlist_t *p_playlist )
strcat
(
psz_dirname
,
DIR_SEP
"ml.xspf"
);
playlist_Export
(
p_playlist
,
psz_dirname
,
p_playlist
->
p_media_library
,
if
(
asprintf
(
&
psz_temp
,
"%s.tmp"
,
psz_dirname
)
<
1
)
return
VLC_EGENERIC
;
int
i_ret
=
playlist_Export
(
p_playlist
,
psz_temp
,
p_playlist
->
p_media_library
,
"export-xspf"
);
if
(
i_ret
!=
VLC_SUCCESS
)
{
vlc_unlink
(
psz_temp
);
free
(
psz_temp
);
return
i_ret
;
}
i_ret
=
vlc_rename
(
psz_temp
,
psz_dirname
);
free
(
psz_temp
);
if
(
i_ret
==
-
1
)
{
msg_Err
(
p_playlist
,
"could not rename %s.tmp: %s"
,
psz_dirname
,
vlc_strerror_c
(
errno
)
);
return
VLC_EGENERIC
;
}
return
VLC_SUCCESS
;
}
Write
Preview
Supports
Markdown
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