Don't check if a file exists right before trying to open it

The open call will tell us what we need to know. Obviously we can't open
a file that doesn't exist. This saves us one stat() or Windows
equivalent.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Thiago Macieira 2013-12-11 17:56:35 -08:00 committed by Dirk Hohndel
parent 841bdf3462
commit 0f3928f315

View file

@ -559,8 +559,7 @@ void DivelogsDeWebServices::prepareDivesForUpload()
char *filename = prepare_dives_for_divelogs(true);
if (filename) {
QFile f(filename);
if (f.exists()) {
f.open(QIODevice::ReadOnly);
if (f.open(QIODevice::ReadOnly)) {
uploadDives((QIODevice *)&f);
f.close();
f.remove();