aboutsummaryrefslogtreecommitdiff
path: root/src/FileUtil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/FileUtil.cpp')
-rw-r--r--src/FileUtil.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/FileUtil.cpp b/src/FileUtil.cpp
index 400b439..d815ebf 100644
--- a/src/FileUtil.cpp
+++ b/src/FileUtil.cpp
@@ -131,4 +131,17 @@ namespace sibs
}
return homeDir;
}
+
+ Result<string> getCwd()
+ {
+ string cwd;
+ cwd.reserve(PATH_MAX);
+ if(getcwd(&cwd[0], PATH_MAX) != 0)
+ {
+ if(cwd.empty()) cwd = ".";
+ return Result<string>::Ok(cwd);
+ }
+
+ return Result<string>::Err(strerror(errno));
+ }
} \ No newline at end of file