link support stable
This commit is contained in:
parent
2f83cf5f05
commit
b093ba7ad4
3 changed files with 12 additions and 1 deletions
|
|
@ -127,6 +127,11 @@ bool Directory::detachNode(const Key& key) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (removeNode->key.incomingLinksHard || removeNode->key.incomingLinksDynamic) {
|
||||
gError = "Cannot modify node with incoming hard links";
|
||||
return false;
|
||||
}
|
||||
|
||||
removeNode->mParent = nullptr;
|
||||
mMembers.remove(DirectoryKey(key));
|
||||
|
||||
|
|
|
|||
|
|
@ -170,7 +170,10 @@ bool FileSystem::moveNode(const Path &source, const Path &target) {
|
|||
return false;
|
||||
}
|
||||
|
||||
assert(sourceParentDirectory->detachNode(key));
|
||||
if (!sourceParentDirectory->detachNode(key)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
assert(targetDirectory->attachNode(key, sourceNode));
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@ int main() {
|
|||
interpreter.interpret("copy a /");
|
||||
|
||||
interpreter.interpret("mdl a/b/c /a-copy/k");
|
||||
|
||||
interpreter.interpret("move a/b/c /a-copy");
|
||||
|
||||
interpreter.interpret("del /a-copy/k/c");
|
||||
|
||||
return UnitTest::RunAllTests();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue