X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ffs%2Funix%2Fdir.cpp;h=0dc950bf00da0b8ff82b5e26e25346be3170be41;hb=9f754b788b872f9768af8c3a4f9e001a588e011a;hp=93aaeab5c73339e668af52e2f077e36839b98bbe;hpb=609c9a508cfdc7b42c46c4f21d17639204165a00;p=libs%2Fcore.git diff --git a/source/fs/unix/dir.cpp b/source/fs/unix/dir.cpp index 93aaeab..0dc950b 100644 --- a/source/fs/unix/dir.cpp +++ b/source/fs/unix/dir.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -21,17 +20,16 @@ void rmdir(const Path &path) throw system_error("rmdir"); } -Path get_home_dir() +Path getcwd() { - const char *home = getenv("HOME"); - if(home) - return home; - return "."; + char buf[1024]; + return ::getcwd(buf, sizeof(buf)); } -Path get_user_data_dir(const string &appname) +void chdir(const Path &path) { - return get_home_dir()/("."+appname); + if(::chdir(path.str().c_str())==-1) + throw system_error("chdir"); } } // namespace FS