X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Futils.h;h=c582c2217ba7b489bbd43fb0801904ffb134c013;hp=a6d956869bf633d531d35e24636b8b37519e35f4;hb=aa31c2bbb399ded6493f7edc419b1a500ed25895;hpb=a17d6ad286e19e2222ab8b6c9a762a83bf2c6c56 diff --git a/source/utils.h b/source/utils.h index a6d9568..c582c22 100644 --- a/source/utils.h +++ b/source/utils.h @@ -8,11 +8,11 @@ Distributed under the LGPL #ifndef MSP_FS_UTILS_H_ #define MSP_FS_UTILS_H_ +#include "path.h" + namespace Msp { namespace FS { -class Path; - /// Extracts the last component of the path. std::string basename(const Path &); @@ -37,9 +37,18 @@ filesystem. */ Path fix_case(const Path &path); +/// Reads the contents of a symbolic link +Path readlink(const Path &path); + +/// Resolves all symlinks from a path. Will always return an absolute path. +Path realpath(const Path &path); + /// Removes a file void unlink(const Path &path); +/// Renames a file. Existing file, if any, is overwritten. +void rename(const Path &from, const Path &to); + /// Makes a path relative to some base path. That is, base/result==path. Path relative(const Path &path, const Path &base);