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
c3aa53cc
Commit
c3aa53cc
authored
Jul 17, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/update/Walk: move configuration to struct UpdateConfig
parent
24a86dce
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
24 deletions
+84
-24
Makefile.am
Makefile.am
+1
-0
Config.cxx
src/db/update/Config.cxx
+36
-0
Config.hxx
src/db/update/Config.hxx
+37
-0
Walk.cxx
src/db/update/Walk.cxx
+8
-17
Walk.hxx
src/db/update/Walk.hxx
+2
-7
No files found.
Makefile.am
View file @
c3aa53cc
...
...
@@ -215,6 +215,7 @@ libmpd_a_SOURCES += \
src/db/LightSong.cxx src/db/LightSong.hxx
\
src/db/LightDirectory.hxx
\
src/db/update/UpdateDomain.cxx src/db/update/UpdateDomain.hxx
\
src/db/update/Config.cxx src/db/update/Config.hxx
\
src/db/update/Service.cxx src/db/update/Service.hxx
\
src/db/update/Queue.cxx src/db/update/Queue.hxx
\
src/db/update/UpdateIO.cxx src/db/update/UpdateIO.hxx
\
...
...
src/db/update/Config.cxx
0 → 100644
View file @
c3aa53cc
/*
* Copyright 2003-2018 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "Config.hxx"
#include "config/Global.hxx"
#include "config/Option.hxx"
UpdateConfig
::
UpdateConfig
()
{
#ifndef _WIN32
follow_inside_symlinks
=
config_get_bool
(
ConfigOption
::
FOLLOW_INSIDE_SYMLINKS
,
DEFAULT_FOLLOW_INSIDE_SYMLINKS
);
follow_outside_symlinks
=
config_get_bool
(
ConfigOption
::
FOLLOW_OUTSIDE_SYMLINKS
,
DEFAULT_FOLLOW_OUTSIDE_SYMLINKS
);
#endif
}
src/db/update/Config.hxx
0 → 100644
View file @
c3aa53cc
/*
* Copyright 2003-2018 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_UPDATE_CONFIG_HXX
#define MPD_UPDATE_CONFIG_HXX
#include "check.h"
struct
UpdateConfig
{
#ifndef _WIN32
static
constexpr
bool
DEFAULT_FOLLOW_INSIDE_SYMLINKS
=
true
;
static
constexpr
bool
DEFAULT_FOLLOW_OUTSIDE_SYMLINKS
=
true
;
bool
follow_inside_symlinks
=
DEFAULT_FOLLOW_INSIDE_SYMLINKS
;
bool
follow_outside_symlinks
=
DEFAULT_FOLLOW_OUTSIDE_SYMLINKS
;
#endif
UpdateConfig
();
};
#endif
src/db/update/Walk.cxx
View file @
c3aa53cc
...
...
@@ -30,8 +30,6 @@
#include "storage/StorageInterface.hxx"
#include "playlist/PlaylistRegistry.hxx"
#include "ExcludeList.hxx"
#include "config/Global.hxx"
#include "config/Option.hxx"
#include "fs/AllocatedPath.hxx"
#include "fs/Traits.hxx"
#include "fs/FileSystem.hxx"
...
...
@@ -57,15 +55,6 @@ UpdateWalk::UpdateWalk(EventLoop &_loop, DatabaseListener &_listener,
storage
(
_storage
),
editor
(
_loop
,
_listener
)
{
#ifndef _WIN32
follow_inside_symlinks
=
config_get_bool
(
ConfigOption
::
FOLLOW_INSIDE_SYMLINKS
,
DEFAULT_FOLLOW_INSIDE_SYMLINKS
);
follow_outside_symlinks
=
config_get_bool
(
ConfigOption
::
FOLLOW_OUTSIDE_SYMLINKS
,
DEFAULT_FOLLOW_OUTSIDE_SYMLINKS
);
#endif
}
static
void
...
...
@@ -273,10 +262,12 @@ UpdateWalk::SkipSymlink(const Directory *directory,
/* don't skip if this is not a symlink */
return
errno
!=
EINVAL
;
if
(
!
follow_inside_symlinks
&&
!
follow_outside_symlinks
)
{
if
(
!
config
.
follow_inside_symlinks
&&
!
config
.
follow_outside_symlinks
)
{
/* ignore all symlinks */
return
true
;
}
else
if
(
follow_inside_symlinks
&&
follow_outside_symlinks
)
{
}
else
if
(
config
.
follow_inside_symlinks
&&
config
.
follow_outside_symlinks
)
{
/* consider all symlinks */
return
false
;
}
...
...
@@ -291,8 +282,8 @@ UpdateWalk::SkipSymlink(const Directory *directory,
const
char
*
relative
=
storage
.
MapToRelativeUTF8
(
target_utf8
.
c_str
());
return
relative
!=
nullptr
?
!
follow_inside_symlinks
:
!
follow_outside_symlinks
;
?
!
config
.
follow_inside_symlinks
:
!
config
.
follow_outside_symlinks
;
}
const
char
*
p
=
target
.
c_str
();
...
...
@@ -304,7 +295,7 @@ UpdateWalk::SkipSymlink(const Directory *directory,
/* we have moved outside the music
directory - skip this symlink
if such symlinks are not allowed */
return
!
follow_outside_symlinks
;
return
!
config
.
follow_outside_symlinks
;
}
p
+=
3
;
}
else
if
(
PathTraitsFS
::
IsSeparator
(
p
[
1
]))
...
...
@@ -317,7 +308,7 @@ UpdateWalk::SkipSymlink(const Directory *directory,
/* we are still in the music directory, so this symlink points
to a song which is already in the database - skip according
to the follow_inside_symlinks param*/
return
!
follow_inside_symlinks
;
return
!
config
.
follow_inside_symlinks
;
#else
/* no symlink checking on WIN32 */
...
...
src/db/update/Walk.hxx
View file @
c3aa53cc
...
...
@@ -21,6 +21,7 @@
#define MPD_UPDATE_WALK_HXX
#include "check.h"
#include "Config.hxx"
#include "Editor.hxx"
#include "Compiler.h"
...
...
@@ -38,13 +39,7 @@ class UpdateWalk final {
friend
class
UpdateArchiveVisitor
;
#endif
#ifndef _WIN32
static
constexpr
bool
DEFAULT_FOLLOW_INSIDE_SYMLINKS
=
true
;
static
constexpr
bool
DEFAULT_FOLLOW_OUTSIDE_SYMLINKS
=
true
;
bool
follow_inside_symlinks
;
bool
follow_outside_symlinks
;
#endif
const
UpdateConfig
config
;
bool
walk_discard
;
bool
modified
;
...
...
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