Skip to content

Commit

Permalink
link: filelink: Use new isWritable function implementation
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
  • Loading branch information
patrickelectric committed Dec 29, 2021
1 parent daa99e4 commit a792a0b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/link/filelink.cpp
Expand Up @@ -38,14 +38,14 @@ void FileLink::writeData(const QByteArray& data)
}

// This save the data as a structure to deal with the timestamp
if (_openModeFlag == QIODevice::WriteOnly && _file.isWritable()) {
if (_openModeFlag == QIODevice::WriteOnly && isWritable()) {
QString time = QTime::fromMSecsSinceStartOfDay(_timer.elapsed()).toString(_timeFormat);
Pack pack {time, data};
_inout << pack.time << pack.data;
} else {
qCWarning(PING_PROTOCOL_FILELINK) << "Something is wrong!";
qCDebug(PING_PROTOCOL_FILELINK) << "File is opened as write only:" << (_openModeFlag == QIODevice::WriteOnly);
qCDebug(PING_PROTOCOL_FILELINK) << "File can be writable:" << _file.isWritable();
qCDebug(PING_PROTOCOL_FILELINK) << "File can be writable:" << isWritable();
}
}

Expand All @@ -70,7 +70,7 @@ bool FileLink::setConfiguration(const LinkConfiguration& linkConfiguration)
// The file will be created when something is received
// Avoiding empty files
// Check if path is writable
return QFileInfo(QFileInfo(_file).canonicalPath()).isWritable();
return isWritable();
}

// Everything after this point is to deal with reading data
Expand Down Expand Up @@ -102,7 +102,7 @@ bool FileLink::startConnection()
// The file will be created when something is received
// Avoiding empty files
if (_openModeFlag == QIODevice::WriteOnly) {
return QFileInfo(QFileInfo(_file).canonicalPath()).isWritable();
return isWritable();
}

if (!isOpen()) {
Expand Down

0 comments on commit a792a0b

Please sign in to comment.