simgear/misc/sg_path.*: added SGPath::makeLink(), for making softlinks.

Note that on Windows there is no implementation yet and it always returns
false.
This commit is contained in:
Julian Smith 2020-12-30 18:08:00 +00:00
parent b888a46e67
commit a7a53921e4
2 changed files with 17 additions and 0 deletions

View File

@ -1108,3 +1108,15 @@ bool SGPath::touch()
_cached = false;
return true;
}
bool SGPath::makeLink(const std::string& destination)
{
#ifdef SG_WINDOWS
return false;
#else
if (symlink(destination.c_str(), c_str())) {
return false;
}
return true;
#endif
}

View File

@ -289,6 +289,11 @@ public:
*/
bool touch();
/**
* Create a link with this path that points to <destination>.
*/
bool makeLink(const std::string& destination);
enum StandardLocation
{
HOME,