From 1736b785dda2ba5b8a81ac0db339c36b579f7f0a Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 10 Dec 2017 14:53:06 +0100 Subject: Change program arguments to use current path as project path Option "-p" can be passed to specify another project path --- src/FileUtil.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/FileUtil.cpp') 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 getCwd() + { + string cwd; + cwd.reserve(PATH_MAX); + if(getcwd(&cwd[0], PATH_MAX) != 0) + { + if(cwd.empty()) cwd = "."; + return Result::Ok(cwd); + } + + return Result::Err(strerror(errno)); + } } \ No newline at end of file -- cgit v1.2.3