@@ -36,17 +36,17 @@ class FileHandle
3636 FileImpl::handleLastErrorImpl (path);
3737 }
3838 }
39-
39+
4040 ~FileHandle ()
4141 {
4242 if (_h != INVALID_HANDLE_VALUE) CloseHandle (_h);
4343 }
44-
44+
4545 HANDLE get () const
4646 {
4747 return _h;
4848 }
49-
49+
5050private:
5151 HANDLE _h;
5252};
@@ -117,7 +117,7 @@ bool FileImpl::existsImpl() const
117117bool FileImpl::canReadImpl () const
118118{
119119 poco_assert (!_path.empty ());
120-
120+
121121 DWORD attr = GetFileAttributesW (_upath.c_str ());
122122 if (attr == INVALID_FILE_ATTRIBUTES)
123123 {
@@ -136,7 +136,7 @@ bool FileImpl::canReadImpl() const
136136bool FileImpl::canWriteImpl () const
137137{
138138 poco_assert (!_path.empty ());
139-
139+
140140 DWORD attr = GetFileAttributesW (_upath.c_str ());
141141 if (attr == INVALID_FILE_ATTRIBUTES)
142142 handleLastErrorImpl (_path);
@@ -196,7 +196,7 @@ Timestamp FileImpl::createdImpl() const
196196 poco_assert (!_path.empty ());
197197
198198 WIN32_FILE_ATTRIBUTE_DATA fad;
199- if (GetFileAttributesExW (_upath.c_str (), GetFileExInfoStandard, &fad) == 0 )
199+ if (GetFileAttributesExW (_upath.c_str (), GetFileExInfoStandard, &fad) == 0 )
200200 handleLastErrorImpl (_path);
201201 return Timestamp::fromFileTimeNP (fad.ftCreationTime .dwLowDateTime , fad.ftCreationTime .dwHighDateTime );
202202}
@@ -207,7 +207,7 @@ Timestamp FileImpl::getLastModifiedImpl() const
207207 poco_assert (!_path.empty ());
208208
209209 WIN32_FILE_ATTRIBUTE_DATA fad;
210- if (GetFileAttributesExW (_upath.c_str (), GetFileExInfoStandard, &fad) == 0 )
210+ if (GetFileAttributesExW (_upath.c_str (), GetFileExInfoStandard, &fad) == 0 )
211211 handleLastErrorImpl (_path);
212212 return Timestamp::fromFileTimeNP (fad.ftLastWriteTime .dwLowDateTime , fad.ftLastWriteTime .dwHighDateTime );
213213}
@@ -234,7 +234,7 @@ FileImpl::FileSizeImpl FileImpl::getSizeImpl() const
234234 poco_assert (!_path.empty ());
235235
236236 WIN32_FILE_ATTRIBUTE_DATA fad;
237- if (GetFileAttributesExW (_upath.c_str (), GetFileExInfoStandard, &fad) == 0 )
237+ if (GetFileAttributesExW (_upath.c_str (), GetFileExInfoStandard, &fad) == 0 )
238238 handleLastErrorImpl (_path);
239239 LARGE_INTEGER li;
240240 li.LowPart = fad.nFileSizeLow ;
@@ -252,12 +252,12 @@ void FileImpl::setSizeImpl(FileSizeImpl size)
252252 li.QuadPart = size;
253253 if (SetFilePointer (fh.get (), li.LowPart , &li.HighPart , FILE_BEGIN) == INVALID_SET_FILE_POINTER)
254254 handleLastErrorImpl (_path);
255- if (SetEndOfFile (fh.get ()) == 0 )
255+ if (SetEndOfFile (fh.get ()) == 0 )
256256 handleLastErrorImpl (_path);
257257}
258258
259259
260- void FileImpl::setWriteableImpl (bool flag)
260+ void FileImpl::setWriteableImpl (bool flag)
261261{
262262 poco_assert (!_path.empty ());
263263
@@ -285,12 +285,8 @@ void FileImpl::copyToImpl(const std::string& path) const
285285
286286 std::wstring upath;
287287 UnicodeConverter::toUTF16 (path, upath);
288- if (CopyFileW (_upath.c_str (), upath.c_str (), FALSE ) != 0 )
289- {
290- FileImpl copy (path);
291- copy.setWriteableImpl (true );
292- }
293- else handleLastErrorImpl (_path);
288+ if (CopyFileW (_upath.c_str (), upath.c_str (), FALSE ) == 0 )
289+ handleLastErrorImpl (_path);
294290}
295291
296292
@@ -300,7 +296,7 @@ void FileImpl::renameToImpl(const std::string& path)
300296
301297 std::wstring upath;
302298 UnicodeConverter::toUTF16 (path, upath);
303- if (MoveFileW (_upath.c_str (), upath.c_str ()) == 0 )
299+ if (MoveFileW (_upath.c_str (), upath.c_str ()) == 0 )
304300 handleLastErrorImpl (_path);
305301}
306302
@@ -311,7 +307,7 @@ void FileImpl::removeImpl()
311307
312308 if (isDirectoryImpl ())
313309 {
314- if (RemoveDirectoryW (_upath.c_str ()) == 0 )
310+ if (RemoveDirectoryW (_upath.c_str ()) == 0 )
315311 handleLastErrorImpl (_path);
316312 }
317313 else
@@ -343,7 +339,7 @@ bool FileImpl::createFileImpl()
343339bool FileImpl::createDirectoryImpl ()
344340{
345341 poco_assert (!_path.empty ());
346-
342+
347343 if (existsImpl () && isDirectoryImpl ())
348344 return false ;
349345 if (CreateDirectoryW (_upath.c_str (), 0 ) == 0 )
0 commit comments