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
b8259e60
Commit
b8259e60
authored
Jul 06, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/update/{Walk,ExcludeList}: use InputStream to read .mpdignore
Supports .mpdignore on NFS/SMB and others (closes #290).
parent
86e2075c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
19 deletions
+21
-19
ExcludeList.cxx
src/db/update/ExcludeList.cxx
+6
-13
ExcludeList.hxx
src/db/update/ExcludeList.hxx
+2
-1
Walk.cxx
src/db/update/Walk.cxx
+13
-5
No files found.
src/db/update/ExcludeList.cxx
View file @
b8259e60
...
@@ -26,8 +26,8 @@
...
@@ -26,8 +26,8 @@
#include "ExcludeList.hxx"
#include "ExcludeList.hxx"
#include "fs/Path.hxx"
#include "fs/Path.hxx"
#include "fs/NarrowPath.hxx"
#include "fs/NarrowPath.hxx"
#include "
fs/io/TextFile
.hxx"
#include "
input/TextInputStream
.hxx"
#include "
system/Error
.hxx"
#include "
util/StringUtil
.hxx"
#include "Log.hxx"
#include "Log.hxx"
#include <stdexcept>
#include <stdexcept>
...
@@ -44,13 +44,13 @@ ExcludeList::ParseLine(char *line) noexcept
...
@@ -44,13 +44,13 @@ ExcludeList::ParseLine(char *line) noexcept
}
}
bool
bool
ExcludeList
::
Load
File
(
Path
path_fs
)
noexcept
ExcludeList
::
Load
(
InputStreamPtr
is
)
try
{
{
#ifdef HAVE_CLASS_GLOB
#ifdef HAVE_CLASS_GLOB
Text
File
file
(
path_fs
);
Text
InputStream
tis
(
std
::
move
(
is
)
);
char
*
line
;
char
*
line
;
while
((
line
=
file
.
ReadLine
())
!=
nullptr
)
while
((
line
=
tis
.
ReadLine
())
!=
nullptr
)
ParseLine
(
line
);
ParseLine
(
line
);
#else
#else
/* not implemented */
/* not implemented */
...
@@ -58,13 +58,6 @@ try {
...
@@ -58,13 +58,6 @@ try {
#endif
#endif
return
true
;
return
true
;
}
catch
(
const
std
::
system_error
&
e
)
{
if
(
!
IsFileNotFound
(
e
))
LogError
(
e
);
return
false
;
}
catch
(
const
std
::
exception
&
e
)
{
LogError
(
e
);
return
false
;
}
}
bool
bool
...
...
src/db/update/ExcludeList.hxx
View file @
b8259e60
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#include "check.h"
#include "check.h"
#include "Compiler.h"
#include "Compiler.h"
#include "fs/Glob.hxx"
#include "fs/Glob.hxx"
#include "input/Ptr.hxx"
#ifdef HAVE_CLASS_GLOB
#ifdef HAVE_CLASS_GLOB
#include <forward_list>
#include <forward_list>
...
@@ -62,7 +63,7 @@ public:
...
@@ -62,7 +63,7 @@ public:
/**
/**
* Loads and parses a .mpdignore file.
* Loads and parses a .mpdignore file.
*/
*/
bool
Load
File
(
Path
path_fs
)
noexcept
;
bool
Load
(
InputStreamPtr
is
)
;
/**
/**
* Checks whether one of the patterns in the .mpdignore file matches
* Checks whether one of the patterns in the .mpdignore file matches
...
...
src/db/update/Walk.cxx
View file @
b8259e60
...
@@ -36,6 +36,9 @@
...
@@ -36,6 +36,9 @@
#include "fs/Traits.hxx"
#include "fs/Traits.hxx"
#include "fs/FileSystem.hxx"
#include "fs/FileSystem.hxx"
#include "storage/FileInfo.hxx"
#include "storage/FileInfo.hxx"
#include "input/InputStream.hxx"
#include "input/Error.hxx"
#include "thread/Cond.hxx"
#include "util/Alloc.hxx"
#include "util/Alloc.hxx"
#include "util/StringCompare.hxx"
#include "util/StringCompare.hxx"
#include "util/UriUtil.hxx"
#include "util/UriUtil.hxx"
...
@@ -345,11 +348,16 @@ UpdateWalk::UpdateDirectory(Directory &directory,
...
@@ -345,11 +348,16 @@ UpdateWalk::UpdateDirectory(Directory &directory,
ExcludeList
child_exclude_list
(
exclude_list
);
ExcludeList
child_exclude_list
(
exclude_list
);
{
try
{
const
auto
exclude_path_fs
=
Mutex
mutex
;
storage
.
MapChildFS
(
directory
.
GetPath
(),
".mpdignore"
);
Cond
cond
;
if
(
!
exclude_path_fs
.
IsNull
())
auto
is
=
InputStream
::
OpenReady
(
PathTraitsUTF8
::
Build
(
storage
.
MapUTF8
(
directory
.
GetPath
()).
c_str
(),
child_exclude_list
.
LoadFile
(
exclude_path_fs
);
".mpdignore"
).
c_str
(),
mutex
,
cond
);
child_exclude_list
.
Load
(
std
::
move
(
is
));
}
catch
(...)
{
if
(
!
IsFileNotFound
(
std
::
current_exception
()))
LogError
(
std
::
current_exception
());
}
}
if
(
!
child_exclude_list
.
IsEmpty
())
if
(
!
child_exclude_list
.
IsEmpty
())
...
...
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