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
292d7c3f
Commit
292d7c3f
authored
Jan 24, 2013
by
Denis Krjuchkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Path: ToUTF() returns std::string
parent
0273cd44
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
11 deletions
+20
-11
ExcludeList.cxx
src/ExcludeList.cxx
+3
-3
Path.cxx
src/fs/Path.cxx
+12
-0
Path.hxx
src/fs/Path.hxx
+5
-8
No files found.
src/ExcludeList.cxx
View file @
292d7c3f
...
...
@@ -37,10 +37,10 @@ ExcludeList::LoadFile(const Path &path_fs)
FILE
*
file
=
fopen
(
path_fs
.
c_str
(),
"r"
);
if
(
file
==
NULL
)
{
if
(
errno
!=
ENOENT
)
{
char
*
path_utf8
=
path_fs
.
ToUTF8
();
const
char
*
msg
=
g_strerror
(
errno
);
const
auto
path_utf8
=
path_fs
.
ToUTF8
();
g_debug
(
"Failed to open %s: %s"
,
path_utf8
,
g_strerror
(
errno
));
g_free
(
path_utf8
);
path_utf8
.
c_str
(),
msg
);
}
return
false
;
...
...
src/fs/Path.cxx
View file @
292d7c3f
...
...
@@ -38,6 +38,18 @@
static
char
*
fs_charset
;
std
::
string
Path
::
ToUTF8
()
const
{
if
(
value
==
nullptr
)
return
std
::
string
();
char
*
path_utf8
=
fs_charset_to_utf8
(
value
);
if
(
path_utf8
==
nullptr
)
return
std
::
string
();
std
::
string
result
=
value
;
g_free
(
path_utf8
);
return
value
;
}
char
*
fs_charset_to_utf8
(
const
char
*
path_fs
)
{
...
...
src/fs/Path.hxx
View file @
292d7c3f
...
...
@@ -26,6 +26,7 @@
#include <glib.h>
#include <algorithm>
#include <string>
#include <assert.h>
#include <string.h>
...
...
@@ -250,15 +251,11 @@ public:
}
/**
* Convert the path to UTF-8.
The caller is responsible for
*
freeing the return value with g_free(). Returns nullptr on
*
error
.
* Convert the path to UTF-8.
*
Returns empty string on error or if this instance is "nulled"
*
(#IsNull returns true)
.
*/
char
*
ToUTF8
()
const
{
return
value
!=
nullptr
?
fs_charset_to_utf8
(
value
)
:
nullptr
;
}
std
::
string
ToUTF8
()
const
;
};
#endif
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