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
b168a9d4
Commit
b168a9d4
authored
Jul 18, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fs/Traits: add Apply()
parent
2b1d6ad3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
0 deletions
+27
-0
AllocatedPath.hxx
src/fs/AllocatedPath.hxx
+5
-0
Traits.cxx
src/fs/Traits.cxx
+14
-0
Traits.hxx
src/fs/Traits.hxx
+8
-0
No files found.
src/fs/AllocatedPath.hxx
View file @
b168a9d4
...
...
@@ -124,6 +124,11 @@ public:
b
.
value
.
c_str
(),
b
.
value
.
size
());
}
gcc_pure
static
AllocatedPath
Apply
(
Path
base
,
Path
path
)
noexcept
{
return
Traits
::
Apply
(
base
.
c_str
(),
path
.
c_str
());
}
/**
* Convert a C string that is already in the filesystem
* character set to a #Path instance.
...
...
src/fs/Traits.cxx
View file @
b168a9d4
...
...
@@ -144,6 +144,20 @@ PathTraitsFS::Relative(const_pointer_type base, const_pointer_type other) noexce
return
RelativePathImpl
<
PathTraitsFS
>
(
base
,
other
);
}
PathTraitsFS
::
string
PathTraitsFS
::
Apply
(
const_pointer_type
base
,
const_pointer_type
path
)
noexcept
{
// TODO: support the Windows syntax (absolute path with or without drive, drive with relative path)
if
(
base
==
nullptr
)
return
path
;
if
(
IsAbsolute
(
path
))
return
path
;
return
Build
(
base
,
path
);
}
PathTraitsUTF8
::
string
PathTraitsUTF8
::
Build
(
const_pointer_type
a
,
size_t
a_size
,
const_pointer_type
b
,
size_t
b_size
)
noexcept
...
...
src/fs/Traits.hxx
View file @
b168a9d4
...
...
@@ -158,6 +158,14 @@ struct PathTraitsFS {
static
string
Build
(
const_pointer_type
a
,
const_pointer_type
b
)
noexcept
{
return
Build
(
a
,
GetLength
(
a
),
b
,
GetLength
(
b
));
}
/**
* Interpret the given path as being relative to the given
* base, and return the concatenated path.
*/
gcc_pure
static
string
Apply
(
const_pointer_type
base
,
const_pointer_type
path
)
noexcept
;
};
/**
...
...
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