diff options
author | dec05eba <dec05eba@protonmail.com> | 2017-12-10 14:53:06 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2017-12-10 14:54:12 +0100 |
commit | 1736b785dda2ba5b8a81ac0db339c36b579f7f0a (patch) | |
tree | 3b9f1e74560981c8ee4ac8eff94175b0b026d59a /src/FileUtil.cpp | |
parent | 20d4d34e136cbbc526fbc0246b07e4d7757b32a1 (diff) |
Change program arguments to use current path as project path
Option "-p" can be passed to specify another project path
Diffstat (limited to 'src/FileUtil.cpp')
-rw-r--r-- | src/FileUtil.cpp | 13 |
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 |