94 const QString cleanPath = QDir::cleanPath(path.toString());
96 const QFileInfo fi(cleanPath);
97 if (fi.exists() && !fi.isDir())
98 location.fatal(u"'%1' exists and is not a directory"_s.arg(cleanPath));
101 if (!dir.exists() && !dir.mkpath(
"."_L1))
102 location.fatal(u"Cannot create output directory '%1'"_s.arg(cleanPath));
125 const QString subdirNameStr = subdirName.toString();
127 if (QDir::isAbsolutePath(subdirNameStr))
128 location.fatal(u"Subdirectory name must be relative, not absolute: '%1'"_s.arg(subdirNameStr));
130 const QString subdirPath = QDir(m_path).filePath(subdirNameStr);
131 const QString cleanSubdirPath = QDir::cleanPath(subdirPath);
133 const QString cleanParentPath = QDir::cleanPath(m_path);
134 const QDir parentDir(cleanParentPath);
135 const QString relativePath = parentDir.relativeFilePath(cleanSubdirPath);
137 if (relativePath.startsWith(
".."_L1 + u'/') || relativePath ==
".."_L1) {
138 location.fatal(u"Refusing to create subdirectory outside parent: '%1' (parent: '%2')"_s
139 .arg(cleanSubdirPath, cleanParentPath));
142 return ensure(cleanSubdirPath, location);
OutputDirectory ensureSubdir(QStringView subdirName, const Location &location) const
Ensures that a subdirectory named subdirName exists within this output directory, creating it if nece...