X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Futils.h;h=b166fede96a8e888f4ea070cce87ede620dfe466;hp=47efcacd9ddb24e299411793ca745ada759ac829;hb=59db379f143f9accda21b831e0243d02f27c1c70;hpb=0ba3e9d15af4e8c30eef5445d2b64fee4870505f diff --git a/source/utils.h b/source/utils.h index 47efcac..b166fed 100644 --- a/source/utils.h +++ b/source/utils.h @@ -53,6 +53,9 @@ std::string basename(const std::string &); /// Tests for existence of a file bool exists(const Path &path); +/// Tests whether a path refers to an existing directory +bool is_dir(const Path &paht); + /** Gets information about a file. Returns 0 on success or -1 on error. This version can be used to check for file existence and get information in one @@ -68,6 +71,12 @@ struct stat stat(const Path &fn); Path getcwd(); +/// Returns the user's home directory +Path get_home_dir(); + +/// Changes the current working directory +void chdir(const Path &); + inline bool is_windows_drive(const std::string &p) { return (p.size()==2 && ((p[0]>='A' && p[0]<='Z') || (p[0]>='a' && p[0]<='z')) && p[1]==':'); }