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
6798af52
Commit
6798af52
authored
Feb 07, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mapper: obtain music directory from Storage
Eliminate duplicate variable.
parent
4d5ebafa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
31 deletions
+19
-31
Main.cxx
src/Main.cxx
+1
-1
Mapper.cxx
src/Mapper.cxx
+17
-29
Mapper.hxx
src/Mapper.hxx
+1
-1
No files found.
src/Main.cxx
View file @
6798af52
...
...
@@ -161,7 +161,7 @@ glue_mapper_init(Error &error)
}
#endif
mapper_init
(
std
::
move
(
music_dir
),
std
::
move
(
playlist_dir
));
mapper_init
(
std
::
move
(
playlist_dir
));
return
true
;
}
...
...
src/Mapper.cxx
View file @
6798af52
...
...
@@ -28,36 +28,20 @@
#include "fs/Charset.hxx"
#include "fs/CheckFile.hxx"
#include <assert.h>
#ifdef ENABLE_DATABASE
/**
* The absolute path of the music directory encoded in the filesystem
* character set.
*/
static
AllocatedPath
music_dir_fs
=
AllocatedPath
::
Null
();
#include "storage/StorageInterface.hxx"
#include "Instance.hxx"
#include "Main.hxx"
#endif
#include <assert.h>
/**
* The absolute path of the playlist directory encoded in the
* filesystem character set.
*/
static
AllocatedPath
playlist_dir_fs
=
AllocatedPath
::
Null
();
#ifdef ENABLE_DATABASE
static
void
mapper_set_music_dir
(
AllocatedPath
&&
path
)
{
assert
(
!
path
.
IsNull
());
music_dir_fs
=
std
::
move
(
path
);
}
#endif
static
void
mapper_set_playlist_dir
(
AllocatedPath
&&
path
)
{
...
...
@@ -69,15 +53,8 @@ mapper_set_playlist_dir(AllocatedPath &&path)
}
void
mapper_init
(
AllocatedPath
&&
_
music_dir
,
AllocatedPath
&&
_
playlist_dir
)
mapper_init
(
AllocatedPath
&&
_playlist_dir
)
{
#ifdef ENABLE_DATABASE
if
(
!
_music_dir
.
IsNull
())
mapper_set_music_dir
(
std
::
move
(
_music_dir
));
#else
(
void
)
_music_dir
;
#endif
if
(
!
_playlist_dir
.
IsNull
())
mapper_set_playlist_dir
(
std
::
move
(
_playlist_dir
));
}
...
...
@@ -94,6 +71,10 @@ map_uri_fs(const char *uri)
assert
(
uri
!=
nullptr
);
assert
(
*
uri
!=
'/'
);
if
(
instance
->
storage
==
nullptr
)
return
AllocatedPath
::
Null
();
const
auto
music_dir_fs
=
instance
->
storage
->
MapFS
(
""
);
if
(
music_dir_fs
.
IsNull
())
return
AllocatedPath
::
Null
();
...
...
@@ -108,6 +89,13 @@ std::string
map_fs_to_utf8
(
const
char
*
path_fs
)
{
if
(
PathTraitsFS
::
IsSeparator
(
path_fs
[
0
]))
{
if
(
instance
->
storage
==
nullptr
)
return
std
::
string
();
const
auto
music_dir_fs
=
instance
->
storage
->
MapFS
(
""
);
if
(
music_dir_fs
.
IsNull
())
return
std
::
string
();
path_fs
=
music_dir_fs
.
RelativeFS
(
path_fs
);
if
(
path_fs
==
nullptr
||
*
path_fs
==
0
)
return
std
::
string
();
...
...
src/Mapper.hxx
View file @
6798af52
...
...
@@ -33,7 +33,7 @@
class
AllocatedPath
;
void
mapper_init
(
AllocatedPath
&&
music_dir
,
AllocatedPath
&&
playlist_dir
);
mapper_init
(
AllocatedPath
&&
playlist_dir
);
void
mapper_finish
(
void
);
...
...
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