Skip to content

Commit 16f4982

Browse files
committed
Allow one-time runner to resolve relative paths
1 parent 72cf523 commit 16f4982

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/nerorunner.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ int NeroRunner::StartOnetime(const QString &path, const bool &prefixAlreadyRunni
471471
QDir dosdevicesPath(NeroFS::GetPrefixesPath().path() + '/' + NeroFS::GetCurrentPrefix() + "/dosdevices");
472472
QFileInfoList dosdevices(dosdevicesPath.entryInfoList(QDir::NoDotAndDotDot | QDir::Dirs, QDir::Name));
473473
// .dots/relative paths don't really need a path fixup.
474-
if(!app.startsWith('.'))
474+
if(!app.startsWith("./") && !app.startsWith("~/") && !app.startsWith("C:/"))
475475
for(auto const device : dosdevices) {
476476
if(app.contains(device.symLinkTarget())) {
477477
app.remove(device.symLinkTarget());
@@ -480,7 +480,7 @@ int NeroRunner::StartOnetime(const QString &path, const bool &prefixAlreadyRunni
480480
}
481481
}
482482

483-
arguments.append(app);
483+
arguments.append(app.replace("C:/", NeroFS::GetPrefixesPath().canonicalPath()+'/'+NeroFS::GetCurrentPrefix()+"/drive_c/"));
484484

485485
if(!args.isEmpty())
486486
arguments.append(args);
@@ -589,7 +589,9 @@ int NeroRunner::StartOnetime(const QString &path, const bool &prefixAlreadyRunni
589589
}
590590

591591
runner.setProcessEnvironment(env);
592-
runner.setWorkingDirectory(path.left(path.lastIndexOf("/")));
592+
if(path.startsWith('/') || path.startsWith("~/") || path.startsWith("./"))
593+
runner.setWorkingDirectory(path.left(path.lastIndexOf("/")).replace("C:", NeroFS::GetPrefixesPath().canonicalPath()+'/'+NeroFS::GetCurrentPrefix()+"/drive_c/"));
594+
593595
QString command = arguments.takeFirst();
594596

595597
QDir logsDir(NeroFS::GetPrefixesPath().path()+'/'+NeroFS::GetCurrentPrefix());

0 commit comments

Comments
 (0)