Skip to content

Commit ee49bc3

Browse files
committed
issue doxygen#11600 Images with read-only file attributes can fail to copy
Improve error handling of Dir::copy
1 parent 2a892d6 commit ee49bc3

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/dir.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,12 +330,12 @@ bool Dir::rename(const std::string &orgName,const std::string &newName,bool acce
330330
bool Dir::copy(const std::string &srcName,const std::string &dstName,bool acceptsAbsPath) const
331331
{
332332
const auto copyOptions = fs::copy_options::overwrite_existing;
333-
std::error_code ec;
333+
std::error_code ec, ec_perm;
334334
std::string sn = filePath(srcName,acceptsAbsPath);
335335
std::string dn = filePath(dstName,acceptsAbsPath);
336336
fs::copy(sn,dn,copyOptions,ec);
337337
// make sure the destination is writable for the owner (see issue #11600)
338-
fs::permissions(dn, fs::perms::owner_write, fs::perm_options::add, ec);
338+
fs::permissions(dn, fs::perms::owner_write, fs::perm_options::add, ec_perm);
339339
return !ec;
340340
}
341341

@@ -356,7 +356,6 @@ bool Dir::setCurrent(const std::string &path)
356356

357357
std::string Dir::cleanDirPath(const std::string &path)
358358
{
359-
std::error_code ec;
360359
std::string result = fs::path(path).lexically_normal().string();
361360
correctPath(result);
362361
return result;

0 commit comments

Comments
 (0)