[fix] Fixed tProxy issue and getConfigPath function

Former-commit-id: 09e4385544
This commit is contained in:
Leroy.H.Y 2019-10-29 18:27:19 +08:00
parent bfc3866b45
commit 14d1896cd9
4 changed files with 19 additions and 6 deletions

View File

@ -1 +1 @@
146
155

View File

@ -43,7 +43,7 @@ namespace Qv2ray
{
ConfigDirPath = *path;
if (path->endsWith("/")) {
if (!path->endsWith("/")) {
ConfigDirPath += "/";
}
}

View File

@ -329,17 +329,30 @@ void PrefrencesWindow::on_tProxyCheckBox_stateChanged(int arg1)
} else {
LOG(MODULE_VCORE, "ENABLING tProxy Support")
LOG(MODULE_FILE, " --> Origin v2ray core file is at: " + CurrentConfig.v2CorePath)
auto v2ctlPath = QFileInfo(QSTRING(CurrentConfig.v2CorePath)).path();
auto v2ctlPath = QFileInfo(QSTRING(CurrentConfig.v2CorePath)).path() + "/v2ctl";
auto newPath = QFileInfo(QV2RAY_DEFAULT_VCORE_PATH).path();
//
LOG(MODULE_FILE, " --> Origin v2ray core file is at: " + v2ctlPath.toStdString() + "v2ctl")
LOG(MODULE_FILE, " --> Origin v2ray core file is at: " + v2ctlPath.toStdString() + "/v2ctl")
LOG(MODULE_FILE, " --> New v2ray files will be placed in: " << newPath.toStdString())
//
LOG(MODULE_FILE, " --> Copying files....")
if (QFile(QV2RAY_DEFAULT_VCORE_PATH).exists()) {
LOG(MODULE_FILE, QV2RAY_DEFAULT_VCORE_PATH.toStdString() << ": File already exists.")
LOG(MODULE_FILE, QV2RAY_DEFAULT_VCORE_PATH.toStdString() << ": Deleting file.")
QFile(QV2RAY_DEFAULT_VCORE_PATH).remove();
}
if (QFile(newPath + "/v2ctl").exists()) {
LOG(MODULE_FILE, newPath.toStdString() << "/v2ctl" << ": File already exists.")
LOG(MODULE_FILE, newPath.toStdString() << "/v2ctl" << ": Deleting file.")
QFile(newPath + "/v2ctl").remove();
}
string vCoreresult = QFile(QSTRING(CurrentConfig.v2CorePath)).copy(QV2RAY_DEFAULT_VCORE_PATH) ? "OK" : "FAILED";
LOG(MODULE_FILE, " --> v2ray Core: " + vCoreresult)
//
string vCtlresult = QFile(v2ctlPath).copy(newPath + "v2ctl") ? "OK" : "FAILED";
string vCtlresult = QFile(v2ctlPath).copy(newPath + "/v2ctl") ? "OK" : "FAILED";
LOG(MODULE_FILE, " --> v2ray Ctl: " + vCtlresult)
//

View File

@ -22,7 +22,7 @@
<property name="modal">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_5" rowstretch="1,1,0" columnstretch="1,2">
<layout class="QGridLayout" name="gridLayout_5" rowstretch="1,1,0" columnstretch="4,7">
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_4">
<property name="title">