Directory: use PathTraitsUTF8::Build() instead of g_strconcat()
This commit is contained in:
parent
db20e29af6
commit
09e5f17b5d
@ -86,20 +86,11 @@ Directory::CreateChild(const char *name_utf8)
|
|||||||
assert(name_utf8 != nullptr);
|
assert(name_utf8 != nullptr);
|
||||||
assert(*name_utf8 != 0);
|
assert(*name_utf8 != 0);
|
||||||
|
|
||||||
char *allocated;
|
std::string path_utf8 = IsRoot()
|
||||||
const char *path_utf8;
|
? std::string(name_utf8)
|
||||||
if (IsRoot()) {
|
: PathTraitsUTF8::Build(GetPath(), name_utf8);
|
||||||
allocated = nullptr;
|
|
||||||
path_utf8 = name_utf8;
|
|
||||||
} else {
|
|
||||||
allocated = g_strconcat(GetPath(),
|
|
||||||
"/", name_utf8, nullptr);
|
|
||||||
path_utf8 = allocated;
|
|
||||||
}
|
|
||||||
|
|
||||||
Directory *child = new Directory(path_utf8, this);
|
|
||||||
g_free(allocated);
|
|
||||||
|
|
||||||
|
Directory *child = new Directory(std::move(path_utf8), this);
|
||||||
list_add_tail(&child->siblings, &children);
|
list_add_tail(&child->siblings, &children);
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user