Merge pull request #158 from JulianGro/fix_paths

Fix paths for importing images and opening directories
This commit is contained in:
ksuprynowicz 2022-08-23 21:37:00 +02:00 committed by GitHub
commit 232bbce940
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4167,7 +4167,11 @@ void Application::loadErrorDomain(QUrl domainURL) {
bool Application::importImage(const QString& urlString) {
qCDebug(interfaceapp) << "An image file has been dropped in";
QString filepath(urlString);
#if defined(Q_OS_WIN)
filepath.remove("file:///");
#else
filepath.remove("file://");
#endif
addAssetToWorld(filepath, "", false, false);
return true;
}
@ -9529,7 +9533,11 @@ void Application::openDirectory(const QString& path) {
}
QString dirPath = path;
#if defined(Q_OS_WIN)
const QString FILE_SCHEME = "file:///";
#else
const QString FILE_SCHEME = "file://";
#endif
if (dirPath.startsWith(FILE_SCHEME)) {
dirPath.remove(0, FILE_SCHEME.length());
}