Skip to content

Commit

Permalink
Base::FileInfo: fix left overs in transient directory
Browse files Browse the repository at this point in the history
Setting ReadWrite permssion removes executable permission, causing
error when removing directory on Linux.
  • Loading branch information
realthunder committed Jul 14, 2019
1 parent 13bec0e commit e55d406
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Base/FileInfo.cpp
Expand Up @@ -526,7 +526,7 @@ bool FileInfo::deleteDirectory(void) const
#elif defined (FC_OS_LINUX) || defined(FC_OS_CYGWIN) || defined(FC_OS_MACOSX) || defined(FC_OS_BSD)
return rmdir(FileName.c_str()) == 0;
#else
# error "FileInfo::createDirectory() not implemented for this platform!"
# error "FileInfo::rmdir() not implemented for this platform!"
#endif
}

Expand All @@ -537,7 +537,12 @@ bool FileInfo::deleteDirectoryRecursive(void) const

for (std::vector<Base::FileInfo>::iterator It = List.begin();It!=List.end();++It) {
if (It->isDir()) {
It->setPermissions(FileInfo::ReadWrite);
// At least on Linux, directory needs execute permission to be
// deleted. We don't really need to set permission for directory
// anyway, since FC code does not touch directory permission.
//
// It->setPermissions(FileInfo::ReadWrite);

It->deleteDirectoryRecursive();
}
else if (It->isFile()) {
Expand Down

0 comments on commit e55d406

Please sign in to comment.