MCPcopy Create free account
hub / github.com/audacity/audacity / DoCopyFile

Method DoCopyFile

libraries/lib-files/FileNames.cpp:144–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142}
143
144bool FileNames::DoCopyFile(
145 const FilePath& file1, const FilePath& file2, bool overwrite)
146{
147#ifdef __WXMSW__
148
149 // workaround not needed
150 return wxCopyFile(file1, file2, overwrite);
151
152#else
153 // PRL: Compensate for buggy wxCopyFile that returns false success,
154 // which was a cause of case 4 in comment 10 of
155 // http://bugzilla.audacityteam.org/show_bug.cgi?id=1759
156 // Destination file was created, but was empty
157 // Bug was introduced after wxWidgets 2.8.12 at commit
158 // 0597e7f977c87d107e24bf3e95ebfa3d60efc249 of wxWidgets repo
159
160 bool existed = wxFileExists(file2);
161 bool result = wxCopyFile(file1, file2, overwrite) &&
162 wxFile{ file1 }.Length() == wxFile{ file2 }.Length();
163 if (!result && !existed)
164 wxRemoveFile(file2);
165 return result;
166
167#endif
168}
169
170bool FileNames::HardLinkFile( const FilePath& file1, const FilePath& file2 )
171{

Callers

nothing calls this directly

Calls 1

LengthMethod · 0.80

Tested by

no test coverage detected