[gnome-commander] Fix for finding the child path
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] Fix for finding the child path
- Date: Sun, 25 Apr 2021 17:06:25 +0000 (UTC)
commit 30d4782f324f22ea861c7217286b3118abce8540
Author: Uwe Scholz <u scholz83 gmx de>
Date: Sun Apr 25 19:02:41 2021 +0200
Fix for finding the child path
Just check first letter of the child to be a backslash character
and check if the length of the upper directory is longer then just 1 character (in the case of '/')
src/gnome-cmd-plain-path.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/gnome-cmd-plain-path.cc b/src/gnome-cmd-plain-path.cc
index e0ebb4c5..1d320503 100644
--- a/src/gnome-cmd-plain-path.cc
+++ b/src/gnome-cmd-plain-path.cc
@@ -55,10 +55,10 @@ GnomeCmdPath *GnomeCmdPlainPath::get_parent()
GnomeCmdPath *GnomeCmdPlainPath::get_child(const gchar *child)
{
auto fullPath = *path == '/'
- ? strchr (child, '/') == nullptr
+ ? *child != '/' && strlen(path) > 1
? g_strconcat(path, G_DIR_SEPARATOR_S, child, nullptr)
: g_strconcat(path, child, nullptr)
- : strchr (child, '/') == nullptr
+ : *child != '/'
? g_strconcat(G_DIR_SEPARATOR_S, path, G_DIR_SEPARATOR_S, child, nullptr)
: g_strconcat(G_DIR_SEPARATOR_S, path, child, nullptr);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]