Use relative path when extra core is located in the nekoray directory (#415)

This commit is contained in:
parhelia512 2025-05-17 02:29:36 +08:00 committed by GitHub
parent 3e18042c24
commit 8b9350bd43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -432,12 +432,12 @@ namespace NekoGui {
if (status->ent->type == "extracore") if (status->ent->type == "extracore")
{ {
auto bean = status->ent->ExtraCoreBean(); auto bean = status->ent->ExtraCoreBean();
status->result->extraCoreData->path = bean->extraCorePath; status->result->extraCoreData->path = QFileInfo(bean->extraCorePath).canonicalFilePath();
status->result->extraCoreData->args = bean->extraCoreArgs; status->result->extraCoreData->args = bean->extraCoreArgs;
status->result->extraCoreData->config = bean->extraCoreConf; status->result->extraCoreData->config = bean->extraCoreConf;
status->result->extraCoreData->configDir = GetBasePath(); status->result->extraCoreData->configDir = GetBasePath();
status->result->extraCoreData->noLog = bean->noLogs; status->result->extraCoreData->noLog = bean->noLogs;
routeChain->Rules << RouteRule::get_processPath_direct_rule(bean->extraCorePath); routeChain->Rules << RouteRule::get_processPath_direct_rule(status->result->extraCoreData->path);
} }
// Direct domains // Direct domains

View File

@ -34,6 +34,10 @@ void EditExtraCore::onStart(std::shared_ptr<NekoGui::ProxyEntity> _ent) {
{ {
return; return;
} }
if (!QDir::current().relativeFilePath(f).startsWith("../../"))
{
f = QDir::current().relativeFilePath(f);
}
if (NekoGui::profileManager->AddExtraCorePath(f)) ui->path_combo->addItem(f); if (NekoGui::profileManager->AddExtraCorePath(f)) ui->path_combo->addItem(f);
ui->path_combo->setCurrentText(f); ui->path_combo->setCurrentText(f);
ui->path_combo->setSizeAdjustPolicy(QComboBox::AdjustToContents); ui->path_combo->setSizeAdjustPolicy(QComboBox::AdjustToContents);