Forgot to close files after copy or error.

Former-commit-id: 157ea611926a5d70d1b469714b6b27b78d513f4b
This commit is contained in:
Alexandre Janniaux
2013-01-04 15:54:39 +01:00
parent 9415096975
commit ce6a63647f

View File

@@ -157,6 +157,7 @@ bool NzFileImpl::Copy(const NzString& sourcePath, const NzString& targetPath)
if (fd2 == -1)
{
NazaraError("Fail to open output file (" + targetPath + "): " + NzGetLastSystemError()); // TODO: more info ?
close(fd1);
return false;
}
@@ -176,6 +177,9 @@ bool NzFileImpl::Copy(const NzString& sourcePath, const NzString& targetPath)
write(fd2,buffer,bytes);
} while (bytes == 512);
close(fd1);
close(fd2);
}
bool NzFileImpl::Delete(const NzString& filePath)