aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWilliam Wennerström <william@wstrm.dev>2020-12-09 19:24:15 +0100
committerWilliam Wennerström <william@wstrm.dev>2020-12-09 19:24:15 +0100
commit073412b8454e95efbf3ff4cee13634130986104e (patch)
tree670450cc6348d344de947219d782699a472f1fe6 /src
parent00dbc1ba7c66c3bb6898aed26922bf5295768bb1 (diff)
downloadprofani-tty-073412b8454e95efbf3ff4cee13634130986104e.tar.gz
Remove stray +2 for path string in get_expanded_path
Diffstat (limited to 'src')
-rw-r--r--src/common.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/common.c b/src/common.c
index 8dbf1619..fc1f60ab 100644
--- a/src/common.c
+++ b/src/common.c
@@ -629,15 +629,15 @@ _basename_from_url(const char* url)
}
gchar*
-get_expanded_path(const char *path)
+get_expanded_path(const char* path)
{
GString* exp_path = g_string_new("");
- gchar *result;
+ gchar* result;
if (strlen(path) >= 2 && path[0] == '~' && path[1] == '/') {
- g_string_printf(exp_path, "%s/%s", getenv("HOME"), path+2);
+ g_string_printf(exp_path, "%s/%s", getenv("HOME"), path + 2);
} else {
- g_string_printf(exp_path, "%s", path+2);
+ g_string_printf(exp_path, "%s", path);
}
result = exp_path->str;
@@ -649,11 +649,11 @@ get_expanded_path(const char *path)
gchar*
unique_filename_from_url(const char* url, const char* path)
{
- gchar *realpath;
+ gchar* realpath;
// Default to './' as path when none has been provided.
if (path == NULL) {
- realpath = strdup("./");
+ realpath = g_strdup("./");
} else {
realpath = get_expanded_path(path);
}