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
177d3b01
Commit
177d3b01
authored
5 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/update/Archive: use MakeDirectoryIfModified()
parent
12beb22c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
30 deletions
+8
-30
Archive.cxx
src/db/update/Archive.cxx
+8
-30
No files found.
src/db/update/Archive.cxx
View file @
177d3b01
...
@@ -38,13 +38,6 @@
...
@@ -38,13 +38,6 @@
#include <string.h>
#include <string.h>
static
Directory
*
static
Directory
*
LockFindChild
(
Directory
&
directory
,
const
char
*
name
)
noexcept
{
const
ScopeDatabaseLock
protect
;
return
directory
.
FindChild
(
name
);
}
static
Directory
*
LockMakeChild
(
Directory
&
directory
,
const
char
*
name
)
noexcept
LockMakeChild
(
Directory
&
directory
,
const
char
*
name
)
noexcept
{
{
const
ScopeDatabaseLock
protect
;
const
ScopeDatabaseLock
protect
;
...
@@ -134,46 +127,31 @@ UpdateWalk::UpdateArchiveFile(Directory &parent, const char *name,
...
@@ -134,46 +127,31 @@ UpdateWalk::UpdateArchiveFile(Directory &parent, const char *name,
const
StorageFileInfo
&
info
,
const
StorageFileInfo
&
info
,
const
ArchivePlugin
&
plugin
)
noexcept
const
ArchivePlugin
&
plugin
)
noexcept
{
{
Directory
*
directory
=
LockFindChild
(
parent
,
name
);
if
(
directory
!=
nullptr
&&
directory
->
mtime
==
info
.
mtime
&&
!
walk_discard
)
/* MPD has already scanned the archive, and it hasn't
changed since - don't consider updating it */
return
;
const
auto
path_fs
=
storage
.
MapChildFS
(
parent
.
GetPath
(),
name
);
const
auto
path_fs
=
storage
.
MapChildFS
(
parent
.
GetPath
(),
name
);
if
(
path_fs
.
IsNull
())
if
(
path_fs
.
IsNull
())
/* not a local file: skip, because the archive API
/* not a local file: skip, because the archive API
supports only local files */
supports only local files */
return
;
return
;
Directory
*
directory
=
LockMakeVirtualDirectoryIfModified
(
parent
,
name
,
info
,
DEVICE_INARCHIVE
);
if
(
directory
==
nullptr
)
/* not modified */
return
;
/* open archive */
/* open archive */
std
::
unique_ptr
<
ArchiveFile
>
file
;
std
::
unique_ptr
<
ArchiveFile
>
file
;
try
{
try
{
file
=
archive_file_open
(
&
plugin
,
path_fs
);
file
=
archive_file_open
(
&
plugin
,
path_fs
);
}
catch
(...)
{
}
catch
(...)
{
LogError
(
std
::
current_exception
());
LogError
(
std
::
current_exception
());
if
(
directory
!=
nullptr
)
editor
.
LockDeleteDirectory
(
directory
);
editor
.
LockDeleteDirectory
(
directory
);
return
;
return
;
}
}
FormatDebug
(
update_domain
,
"archive %s opened"
,
path_fs
.
c_str
());
FormatDebug
(
update_domain
,
"archive %s opened"
,
path_fs
.
c_str
());
if
(
directory
==
nullptr
)
{
FormatDebug
(
update_domain
,
"creating archive directory: %s"
,
name
);
const
ScopeDatabaseLock
protect
;
directory
=
parent
.
CreateChild
(
name
);
/* mark this directory as archive (we use device for
this) */
directory
->
device
=
DEVICE_INARCHIVE
;
}
directory
->
mtime
=
info
.
mtime
;
UpdateArchiveVisitor
visitor
(
*
this
,
*
file
,
directory
);
UpdateArchiveVisitor
visitor
(
*
this
,
*
file
,
directory
);
file
->
Visit
(
visitor
);
file
->
Visit
(
visitor
);
}
}
...
...
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