mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 10:32:57 +01:00
Fixed File on Unix to pass the Rename Tests
This commit is contained in:
parent
8b4ef5f706
commit
6c662bfb4a
@ -384,6 +384,11 @@ void FileImpl::renameToImpl(const std::string& path, bool failOnOverwrite)
|
||||
{
|
||||
poco_assert (!_path.empty());
|
||||
|
||||
struct stat st;
|
||||
|
||||
if (stat(path.c_str(), &st) == 0)
|
||||
throw FileExistsException(path, EEXIST);
|
||||
|
||||
if (rename(_path.c_str(), path.c_str()) != 0)
|
||||
handleLastErrorImpl(_path);
|
||||
}
|
||||
|
@ -286,6 +286,11 @@ void FileImpl::renameToImpl(const std::string& path, bool failOnOverwrite)
|
||||
{
|
||||
poco_assert (!_path.empty());
|
||||
|
||||
struct stat st;
|
||||
|
||||
if (stat(path.c_str(), &st) == 0)
|
||||
throw FileExistsException(path, EEXIST);
|
||||
|
||||
if (rename(_path.c_str(), path.c_str()) != 0)
|
||||
handleLastErrorImpl(_path);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user