Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LogFileImpl::createFile() error #4783

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Foundation/include/Poco/File_WIN32U.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Foundation_API FileImpl
void renameToImpl(const std::string& path, int options = 0);
void linkToImpl(const std::string& path, int type) const;
void removeImpl();
bool createFileImpl();
bool createFileImpl(bool createDirectories = false);
bool createDirectoryImpl();
FileSizeImpl totalSpaceImpl() const;
FileSizeImpl usableSpaceImpl() const;
Expand Down
7 changes: 6 additions & 1 deletion Foundation/src/File_UNIX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,10 +459,15 @@ void FileImpl::removeImpl()
}


bool FileImpl::createFileImpl()
bool FileImpl::createFileImpl(bool createDirectories = false)
{
poco_assert (!_path.empty());

if(createDirectories) {
Path p(_path);
p.makeDirectory();
}

int n = open(_path.c_str(), O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
if (n != -1)
{
Expand Down
6 changes: 5 additions & 1 deletion Foundation/src/File_VX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,14 @@ void FileImpl::removeImpl()
}


bool FileImpl::createFileImpl()
bool FileImpl::createFileImpl(bool createDirectories = false)
{
poco_assert (!_path.empty());

if(createDirectories) {
Path p(_path);
p.makeDirectory();
}
int n = open(_path.c_str(), O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
if (n != -1)
{
Expand Down
7 changes: 6 additions & 1 deletion Foundation/src/File_WIN32U.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,15 @@ void FileImpl::removeImpl()
}


bool FileImpl::createFileImpl()
bool FileImpl::createFileImpl(bool createDirectories = false)
{
poco_assert (!_path.empty());

if(createDirectories) {
Path p(_path);
p.makeDirectory();
}

HANDLE hFile = CreateFileW(_upath.c_str(), GENERIC_WRITE, 0, 0, CREATE_NEW, 0, 0);
if (hFile != INVALID_HANDLE_VALUE)
{
Expand Down
Loading