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
9a78371b
Commit
9a78371b
authored
May 21, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DetachedSong: allow LoadFile(), Update() to throw
parent
3fc4da38
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
10 deletions
+12
-10
SongUpdate.cxx
src/SongUpdate.cxx
+5
-7
DetachedSong.hxx
src/song/DetachedSong.hxx
+6
-2
test_translate_song.cxx
test/test_translate_song.cxx
+1
-1
No files found.
src/SongUpdate.cxx
View file @
9a78371b
...
...
@@ -135,10 +135,10 @@ Song::UpdateFileInArchive(ArchiveFile &archive) noexcept
#endif
bool
DetachedSong
::
LoadFile
(
Path
path
)
noexcept
DetachedSong
::
LoadFile
(
Path
path
)
{
FileInfo
fi
;
if
(
!
GetFileInfo
(
path
,
fi
)
||
!
fi
.
IsRegular
())
const
FileInfo
fi
(
path
)
;
if
(
!
fi
.
IsRegular
())
return
false
;
TagBuilder
tag_builder
;
...
...
@@ -151,13 +151,11 @@ DetachedSong::LoadFile(Path path) noexcept
}
bool
DetachedSong
::
Update
()
noexcept
DetachedSong
::
Update
()
{
if
(
IsAbsoluteFile
())
{
const
AllocatedPath
path_fs
=
AllocatedPath
::
FromUTF8
(
GetRealURI
());
if
(
path_fs
.
IsNull
())
return
false
;
AllocatedPath
::
FromUTF8Throw
(
GetRealURI
());
return
LoadFile
(
path_fs
);
}
else
if
(
IsRemote
())
{
...
...
src/song/DetachedSong.hxx
View file @
9a78371b
...
...
@@ -234,14 +234,18 @@ public:
/**
* Update the #tag and #mtime.
*
* Throws on error.
*
* @return true on success
*/
bool
Update
()
noexcept
;
bool
Update
();
/**
* Load #tag and #mtime from a local file.
*
* Throws on error.
*/
bool
LoadFile
(
Path
path
)
noexcept
;
bool
LoadFile
(
Path
path
);
};
#endif
test/test_translate_song.cxx
View file @
9a78371b
...
...
@@ -96,7 +96,7 @@ DatabaseDetachSong(gcc_unused const Database &db,
}
bool
DetachedSong
::
LoadFile
(
Path
path
)
noexcept
DetachedSong
::
LoadFile
(
Path
path
)
{
if
(
path
.
ToUTF8
()
==
uri1
)
{
SetTag
(
MakeTag1a
());
...
...
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