wasm: Make sure QDir::mkpath("/") works on webassembly
As described in bug QTBUG-127767 mkdir("/") returns ENOSPC on webassembly, and the code is not prepared to handle that. We solve it by explicitly checking for "/" which shall always be present. Fixes: QTBUG-127767 Change-Id: Icf86f0b681ac3bd8ddc97c1a4168c2faf02aa4a1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
cda53f290f
commit
0568511e84
@ -1078,6 +1078,11 @@ bool QFileSystemEngine::cloneFile(int srcfd, int dstfd, const QFileSystemMetaDat
|
||||
static bool createDirectoryWithParents(const QByteArray &nativeName, mode_t mode,
|
||||
bool shouldMkdirFirst = true)
|
||||
{
|
||||
#ifdef Q_OS_WASM
|
||||
if (nativeName.length() == 1 && nativeName[0] == '/')
|
||||
return true;
|
||||
#endif
|
||||
|
||||
// helper function to check if a given path is a directory, since mkdir can
|
||||
// fail if the dir already exists (it may have been created by another
|
||||
// thread or another process)
|
||||
|
@ -522,9 +522,6 @@ void tst_QDir::makedirReturnCode()
|
||||
|
||||
// the next line specifically targets Windows and macOS (QTBUG-85997, QTBUG-97110)
|
||||
// calling mkpath on an existing drive name (Windows) or root path (macOS) shall pass
|
||||
#ifdef Q_OS_WASM
|
||||
QEXPECT_FAIL("", "fails on wasm, see bug QTBUG-127767", Continue);
|
||||
#endif
|
||||
QVERIFY(QDir().mkpath(QDir::rootPath()));
|
||||
QVERIFY(!QDir().mkdir(QDir::rootPath()));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user