aboutsummaryrefslogtreecommitdiff
path: root/core/cwd.c
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2023-02-15 17:12:34 +0100
committerNathan Reiner <nathan@nathanreiner.xyz>2023-02-15 17:12:34 +0100
commit919b48f8e237a8c8b5b91c05304c817eec49e8f0 (patch)
tree9e01e016f6d3a07aa2b86eb8c542bc1a90784d8c /core/cwd.c
parent99fdad9a3abc7f3ba871575f585d254351e5a8d3 (diff)
add '/' on end when non root
Diffstat (limited to 'core/cwd.c')
-rw-r--r--core/cwd.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/cwd.c b/core/cwd.c
index ab858c7..d984e6a 100644
--- a/core/cwd.c
+++ b/core/cwd.c
@@ -6,6 +6,12 @@ char buf[1024] = { 0 };
int main()
{
getcwd(buf, 1024);
- wstdf("%s\n", buf);
+
+ if (buf[0] == '/' && buf[1] == 0) {
+ wstdf("%s\n", buf);
+ } else {
+ wstdf("%s/\n", buf);
+ }
+
return 0;
}