qt: Account for empty path in plat_fopen
This commit is contained in:
@@ -163,7 +163,7 @@ plat_fopen(const char *path, const char *mode)
|
|||||||
{
|
{
|
||||||
#if defined(Q_OS_MACOS) or defined(Q_OS_LINUX)
|
#if defined(Q_OS_MACOS) or defined(Q_OS_LINUX)
|
||||||
QFileInfo fi(path);
|
QFileInfo fi(path);
|
||||||
QString filename = fi.isRelative() ? usr_path + fi.filePath() : fi.filePath();
|
QString filename = (fi.isRelative() && !fi.filePath().isEmpty()) ? usr_path + fi.filePath() : fi.filePath();
|
||||||
return fopen(filename.toUtf8().constData(), mode);
|
return fopen(filename.toUtf8().constData(), mode);
|
||||||
#else
|
#else
|
||||||
return fopen(QString::fromUtf8(path).toLocal8Bit(), mode);
|
return fopen(QString::fromUtf8(path).toLocal8Bit(), mode);
|
||||||
@@ -175,7 +175,7 @@ plat_fopen64(const char *path, const char *mode)
|
|||||||
{
|
{
|
||||||
#if defined(Q_OS_MACOS) or defined(Q_OS_LINUX)
|
#if defined(Q_OS_MACOS) or defined(Q_OS_LINUX)
|
||||||
QFileInfo fi(path);
|
QFileInfo fi(path);
|
||||||
QString filename = fi.isRelative() ? usr_path + fi.filePath() : fi.filePath();
|
QString filename = (fi.isRelative() && !fi.filePath().isEmpty()) ? usr_path + fi.filePath() : fi.filePath();
|
||||||
return fopen(filename.toUtf8().constData(), mode);
|
return fopen(filename.toUtf8().constData(), mode);
|
||||||
#else
|
#else
|
||||||
return fopen(QString::fromUtf8(path).toLocal8Bit(), mode);
|
return fopen(QString::fromUtf8(path).toLocal8Bit(), mode);
|
||||||
|
Reference in New Issue
Block a user