if(!link.empty())
{
FS::Path relpath = FS::relative(dst_path, FS::dirname(link));
+ if(FS::exists(link))
+ FS::unlink(link);
symlink(relpath.str().c_str(), link.str().c_str());
}
mark_rebuild(source.get_name()+" has changed");
else if(source.needs_rebuild())
mark_rebuild(source.get_name()+" needs rebuilding");
- else if(!link.empty() && !FS::exists(link))
- mark_rebuild("Symlink does not exist");
+ if(!needs_rebuild() && !link.empty())
+ {
+ if(!FS::exists(link))
+ mark_rebuild("Symlink does not exist");
+ else
+ {
+ FS::Path rel_path = FS::relative(path, FS::dirname(link));
+ if(FS::readlink(link)!=rel_path)
+ mark_rebuild("Symlink needs updating");
+ }
+ }
}
void InstalledFile::clean()