Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
b6b8fb7d
Commit
b6b8fb7d
authored
8 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PlaylistFile: use TruncateFile()
As a side effect, "playlistclear" no longer creates a new playlist if the given one doesn't yet exist.
parent
2bca3cd2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
PlaylistFile.cxx
src/PlaylistFile.cxx
+9
-5
No files found.
src/PlaylistFile.cxx
View file @
b6b8fb7d
...
...
@@ -302,11 +302,15 @@ spl_clear(const char *utf8path)
const
auto
path_fs
=
spl_map_to_fs
(
utf8path
);
assert
(
!
path_fs
.
IsNull
());
FILE
*
file
=
FOpen
(
path_fs
,
FOpenMode
::
WriteText
);
if
(
file
==
nullptr
)
ThrowPlaylistErrno
();
fclose
(
file
);
try
{
TruncateFile
(
path_fs
);
}
catch
(
const
std
::
system_error
&
e
)
{
if
(
IsFileNotFound
(
e
))
throw
PlaylistError
(
PlaylistResult
::
NO_SUCH_LIST
,
"No such playlist"
);
else
throw
;
}
idle_add
(
IDLE_STORED_PLAYLIST
);
}
...
...
This diff is collapsed.
Click to expand it.
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