X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Futils.cpp;h=33981b227e744baa5f20eae390694e5ddb9435f8;hp=18784b3a423bb8b5d165c79ef95d72db0d594877;hb=35fb95f1ece11ba5186c267ae2c22e2f89962455;hpb=3004842aa3281f26137c7332089068da7edb34af diff --git a/source/utils.cpp b/source/utils.cpp index 18784b3..33981b2 100644 --- a/source/utils.cpp +++ b/source/utils.cpp @@ -6,7 +6,8 @@ Distributed under the LGPL */ #include -#include +#include +#include #include #ifndef WIN32 #include @@ -189,7 +190,7 @@ Path relative(const Path &path, const Path &base) { Path::Iterator i=path.begin(); Path::Iterator j=base.begin(); - for(; (i!=path.end() && j!=base.end() && *i==*j); ++i,++j); + for(; (i!=path.end() && j!=base.end() && *i==*j); ++i, ++j) ; Path result; for(; j!=base.end(); ++j) @@ -244,4 +245,10 @@ Path get_home_dir() #endif } +void chdir(const Path &path) +{ + if(::chdir(path.str().c_str())==-1) + throw SystemError("chdir failed", errno); +} + } // namespace Msp