Skip to content

Commit dbafdbc

Browse files
committed
fixed absolute paths not working in the launch command
1 parent d94439d commit dbafdbc

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

Sources/MainWindow.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -795,12 +795,10 @@ void MainWindow::toggleAbsolutePaths( bool absolute )
795795
for (Engine & engine : engines)
796796
engine.path = pathHelper.convertPath( engine.path );
797797

798-
if (iwadListFromDir && !iwadDir.isEmpty()) {
798+
if (iwadListFromDir && !iwadDir.isEmpty())
799799
iwadDir = pathHelper.convertPath( iwadDir );
800-
} else {
801-
for (IWAD & iwad : iwads)
802-
iwad.path = pathHelper.convertPath( iwad.path );
803-
}
800+
for (IWAD & iwad : iwads)
801+
iwad.path = pathHelper.convertPath( iwad.path );
804802

805803
mapDir = pathHelper.convertPath( mapDir );
806804

Sources/Utils.hpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -354,15 +354,11 @@ class PathHelper {
354354

355355
QString getAbsolutePath( QString path ) const
356356
{
357-
if (path.isEmpty())
358-
return {};
359-
return QFileInfo( _baseDir, path ).absoluteFilePath();
357+
return path.isEmpty() ? "" : QFileInfo( _baseDir, path ).absoluteFilePath();
360358
}
361359
QString getRelativePath( QString path ) const
362360
{
363-
if (path.isEmpty())
364-
return {};
365-
return _baseDir.relativeFilePath( path );
361+
return path.isEmpty() ? "" : _baseDir.relativeFilePath( path );
366362
}
367363
QString convertPath( QString path ) const
368364
{
@@ -373,6 +369,8 @@ class PathHelper {
373369
{
374370
if (path.isEmpty())
375371
return {};
372+
if (QDir::isAbsolutePath( path ))
373+
return path;
376374
QString absPath = _currentDir.filePath( path );
377375
return _baseDir.relativeFilePath( absPath );
378376
}

0 commit comments

Comments
 (0)