Skip to content
This repository has been archived by the owner on May 4, 2023. It is now read-only.

Commit

Permalink
ISS #101
Browse files Browse the repository at this point in the history
!- Resolve #101.
   *# Modify Visual C++ Project file.
    : Add Json resource files.
    : Copy them when building executables.
   *# Move `data/` and `logs/` to `AppData/Local/WCH`.
   *# Move `.tmp` temporary files to `AppData/Local/Temp`.
   x# Delete unused Visual C++ Project Resources file.
*G Modify Git Ignore file.
 : Remove unused part.
  • Loading branch information
ren-yc committed Oct 29, 2022
1 parent e74b965 commit 3a50bc6
Show file tree
Hide file tree
Showing 9 changed files with 156 additions and 81 deletions.
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,4 @@
/UnitTest/ARM/
/UnitTest/ARM64/
/.vscode/
/.vs/
/data/*.json
/logs/*.log
*.tmp
settings.json
/.vs/
6 changes: 2 additions & 4 deletions WCH.rc
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ Web Class Helper Resource File 2.1.1
This source code file isn't under any license.
Generator: Visual Studio 2022
*/
#include "resource.hpp"
#define APSTUDIO_READONLY_SYMBOLS
#include "winres.h"
#undef APSTUDIO_READONLY_SYMBOLS
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
#if !defined(AFX_RESOURCE_DLL)
#pragma code_page(65001)
#ifdef APSTUDIO_INVOKED
1 TEXTINCLUDE
Expand All @@ -26,7 +24,7 @@ BEGIN
"\0"
END
#endif
IDI_ICON1 ICON "WCH.ico"
IDI_ICON ICON "WCH.ico"
#endif
#ifndef APSTUDIO_INVOKED
#endif
74 changes: 72 additions & 2 deletions WCH.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -429,13 +429,83 @@
<ClInclude Include="modules\functions.hpp" />
<ClInclude Include="modules\init.hpp" />
<ClInclude Include="modules\basic.hpp" />
<ClInclude Include="resource.hpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="WCH.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="WCH.ico" />
<CopyFileToFolders Include="LICENSE">
<FileType>Document</FileType>
</CopyFileToFolders>
<CopyFileToFolders Include="WCH.ico">
<FileType>Document</FileType>
</CopyFileToFolders>
<CopyFileToFolders Include="resources\en-US\config.json">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)\resources\en-US</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)\resources\en-US</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\resources\en-US</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\resources\en-US</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">$(OutDir)\resources\en-US</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">$(OutDir)\resources\en-US</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">$(OutDir)\resources\en-US</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">$(OutDir)\resources\en-US</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="resources\en-US\help.json">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)\resources\en-US</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)\resources\en-US</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\resources\en-US</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\resources\en-US</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">$(OutDir)\resources\en-US</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">$(OutDir)\resources\en-US</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">$(OutDir)\resources\en-US</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">$(OutDir)\resources\en-US</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="resources\en-US\interactive.json">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)\resources\en-US</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)\resources\en-US</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\resources\en-US</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\resources\en-US</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">$(OutDir)\resources\en-US</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">$(OutDir)\resources\en-US</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">$(OutDir)\resources\en-US</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">$(OutDir)\resources\en-US</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="resources\zh-CN\config.json">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)\resources\zh-CN</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)\resources\zh-CN</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\resources\zh-CN</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\resources\zh-CN</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">$(OutDir)\resources\zh-CN</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">$(OutDir)\resources\zh-CN</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">$(OutDir)\resources\zh-CN</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">$(OutDir)\resources\zh-CN</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="resources\zh-CN\help.json">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)\resources\zh-CN</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)\resources\zh-CN</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\resources\zh-CN</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\resources\zh-CN</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">$(OutDir)\resources\zh-CN</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">$(OutDir)\resources\zh-CN</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">$(OutDir)\resources\zh-CN</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">$(OutDir)\resources\zh-CN</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="resources\zh-CN\interactive.json">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)\resources\zh-CN</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)\resources\zh-CN</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\resources\zh-CN</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\resources\zh-CN</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">$(OutDir)\resources\zh-CN</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">$(OutDir)\resources\zh-CN</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">$(OutDir)\resources\zh-CN</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">$(OutDir)\resources\zh-CN</DestinationFolders>
</CopyFileToFolders>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
Expand Down
14 changes: 8 additions & 6 deletions WCH.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,20 @@
<ClInclude Include="modules\basic.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="WCH.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="WCH.ico">
<Filter>Resource Files</Filter>
</Image>
<CopyFileToFolders Include="LICENSE" />
<CopyFileToFolders Include="WCH.ico" />
<CopyFileToFolders Include="resources\en-US\config.json" />
<CopyFileToFolders Include="resources\en-US\help.json" />
<CopyFileToFolders Include="resources\en-US\interactive.json" />
<CopyFileToFolders Include="resources\zh-CN\config.json" />
<CopyFileToFolders Include="resources\zh-CN\help.json" />
<CopyFileToFolders Include="resources\zh-CN\interactive.json" />
</ItemGroup>
</Project>
29 changes: 22 additions & 7 deletions modules/apis.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,27 @@ wstring WCH_GetCompileTime() {
return format(L"{}/{:02}/{:02} {}", spi.substr(7, 4), mon[spi.substr(0, 3)], stoi(spi[4] == L' ' ? spi.substr(5, 1) : spi.substr(4, 2)), StrToWstr(__TIME__));
}

wstring WCH_GetExecDir() {
// Get program executable directory.
wstring _res = _wpgmptr;
size_t _pos = 0;
for (size_t i = 0; i < _res.size(); i++) {
if (_res[i] == L'\\') {
_pos = i;
}
}
return _res.substr(0, _pos);
}

wstring WCH_GetUniIdent() {
// Get unique identification. (Public IP)
wstring FilePath = format(L"{}\\AppData\\Local\\Temp\\WCH_IDENT.tmp", _wgetenv(L"USERPROFILE"));
wstring _in, _res;
URLDownloadToFileW(NULL, L"https://api.ipify.org", L"WCH_IDENT.tmp", 0, NULL);
wfin.open(L"WCH_IDENT.tmp");
URLDownloadToFileW(NULL, L"https://api.ipify.org", FilePath.c_str(), 0, NULL);
wfin.open(FilePath);
wfin >> _in;
wfin.close();
DeleteFileW(L"WCH_IDENT.tmp");
DeleteFileW(FilePath.c_str());
for (size_t i = 0; i < _in.size(); i++) {
if (_in[i] != L'.') {
_res.push_back(_in[i]);
Expand Down Expand Up @@ -356,10 +369,12 @@ bool WCH_FileIsBlank(const wstring& _filename) {

bool WCH_TaskKill(const wstring& name) {
// Kill a task by system command.
_wsystem((L"TASKKILL /F /IM " + name + L" > WCH_SYSTEM_NORMAL.tmp 2> WCH_SYSTEM_ERROR.tmp").c_str());
wstring FilePathNormal = format(L"{}\\AppData\\Local\\Temp\\WCH_SYSTEM_NORMAL.tmp", _wgetenv(L"USERPROFILE"));
wstring FilePathError = format(L"{}\\AppData\\Local\\Temp\\WCH_SYSTEM_ERROR.tmp", _wgetenv(L"USERPROFILE"));
_wsystem(format(L"TASKKILL /F /IM {} > \"{}\" 2> \"{}\"", name, FilePathNormal, FilePathError).c_str());
bool _res = (!WCH_FileIsBlank(L"WCH_SYSTEM_NORMAL.tmp") && WCH_FileIsBlank(L"WCH_SYSTEM_ERROR.tmp"));
DeleteFileW(L"WCH_SYSTEM_NORMAL.tmp");
DeleteFileW(L"WCH_SYSTEM_ERROR.tmp");
DeleteFileW(FilePathNormal.c_str());
DeleteFileW(FilePathError.c_str());
return _res;
}

Expand Down Expand Up @@ -486,7 +501,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
WCH_NID.uID = 0;
WCH_NID.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
WCH_NID.uCallbackMessage = WM_USER;
WCH_NID.hIcon = (HICON)LoadImageW(NULL, L"WCH.ico", IMAGE_ICON, 0, 0, LR_LOADFROMFILE);
WCH_NID.hIcon = (HICON)LoadImageW(NULL, (WCH_GetExecDir() + L"\\WCH.ico").c_str(), IMAGE_ICON, 0, 0, LR_LOADFROMFILE);
wcscpy(WCH_NID.szTip, WCH_window_title.c_str());
Shell_NotifyIconW(NIM_ADD, &WCH_NID);
WCH_menu_handle = CreatePopupMenu();
Expand Down
58 changes: 31 additions & 27 deletions modules/commands.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void WCH_clear() {
WCH_InputCommandIncorrect();
return;
}
system("cls");
system("CLS");
wcout << WCH_window_title << endl;
wcout << StrToWstr(WCH_Language["Start"].asString()) << endl;
}
Expand All @@ -94,13 +94,13 @@ void WCH_exit() {
WCH_printlog(WCH_LOG_STATUS_INFO, format(L"Exiting \"Web Class Helper {}{}\"", WCH_VER_MAIN, fullver));
WCH_cmd_line = false;
WCH_program_end = true;
WCH_CheckAndDeleteFile(L"WCH_SYSTEM_NORMAL.tmp");
WCH_CheckAndDeleteFile(L"WCH_SYSTEM_ERROR.tmp");
WCH_CheckAndDeleteFile(L"WCH_UPD.tmp");
WCH_CheckAndDeleteFile(L"WCH_TRANS.tmp");
WCH_CheckAndDeleteFile(L"WCH_OW.tmp");
WCH_CheckAndDeleteFile(L"WCH_FATE.tmp");
WCH_CheckAndDeleteFile(L"WCH_IDENT.tmp");
WCH_CheckAndDeleteFile(format(L"{}\\AppData\\Local\\Temp\\WCH_SYSTEM_NORMAL.tmp", _wgetenv(L"USERPROFILE")));
WCH_CheckAndDeleteFile(format(L"{}\\AppData\\Local\\Temp\\WCH_SYSTEM_ERROR.tmp", _wgetenv(L"USERPROFILE")));
WCH_CheckAndDeleteFile(format(L"{}\\AppData\\Local\\Temp\\WCH_UPD.tmp", _wgetenv(L"USERPROFILE")));
WCH_CheckAndDeleteFile(format(L"{}\\AppData\\Local\\Temp\\WCH_TRANS.tmp", _wgetenv(L"USERPROFILE")));
WCH_CheckAndDeleteFile(format(L"{}\\AppData\\Local\\Temp\\WCH_OW.tmp", _wgetenv(L"USERPROFILE")));
WCH_CheckAndDeleteFile(format(L"{}\\AppData\\Local\\Temp\\WCH_FATE.tmp", _wgetenv(L"USERPROFILE")));
WCH_CheckAndDeleteFile(format(L"{}\\AppData\\Local\\Temp\\WCH_IDENT.tmp", _wgetenv(L"USERPROFILE")));
SendMessageW(WCH_tray_handle, WM_DESTROY, NULL, NULL);
_exit(0);
}
Expand Down Expand Up @@ -135,17 +135,18 @@ void WCH_update() {
WCH_ProgressBarTot = 5;
thread T(WCH_ProgressBar);
T.detach();
wstring FilePath = format(L"{}\\AppData\\Local\\Temp\\WCH_UPD.tmp", _wgetenv(L"USERPROFILE"));
wstring url = L"https://class-tools.github.io/update/WCH?";
random_device rd;
mt19937 mtrand(rd());
url.append(to_wstring(mtrand()));
URLDownloadToFileW(0, url.c_str(), L"WCH_UPD.tmp", 0, 0);
URLDownloadToFileW(0, url.c_str(), FilePath.c_str(), 0, 0);
wstring res;
wfin.open(L"WCH_UPD.tmp");
wfin.open(FilePath);
getline(wfin, res);
wfin.close();
WCH_Sleep(5000);
if (WCH_FileIsBlank(L"WCH_UPD.tmp")) {
if (WCH_FileIsBlank(FilePath)) {
throw runtime_error("");
}
if (WCH_GetVersion(WCH_VER_MAIN) < WCH_GetVersion(res)) {
Expand All @@ -156,7 +157,7 @@ void WCH_update() {
wcout << StrToWstr(WCH_Language["NoUpdate"].asString()) << endl;
WCH_printlog(WCH_LOG_STATUS_INFO, L"Program version equals or is greater than \"" + res + L"\"");
}
DeleteFileW(L"WCH_UPD.tmp");
DeleteFileW(FilePath.c_str());
} catch (...) {
WCH_NetworkError();
return;
Expand All @@ -169,7 +170,7 @@ void WCH_license() {
WCH_InputCommandIncorrect();
return;
}
wfin.open(L"LICENSE");
wfin.open(WCH_GetExecDir() + L"\\LICENSE");
if (!wfin.is_open()) {
WCH_FileProcessingFailed();
return;
Expand Down Expand Up @@ -687,12 +688,13 @@ void WCH_trans() {
return;
}
try {
URLDownloadToFileW(NULL, (L"http://fanyi.youdao.com/openapi.do?keyfrom=xujiangtao&key=1490852988&type=data&doctype=json&version=1.1&only=translate&q=" + StrToWstr(UrlEncode(WstrToStr((WCH_command_list[1]))))).c_str(), L"WCH_TRANS.tmp", 0, NULL);
if (WCH_FileIsBlank(L"WCH_TRANS.tmp")) {
wstring FilePath = format(L"{}\\AppData\\Local\\Temp\\WCH_TRANS.tmp", _wgetenv(L"USERPROFILE"));
URLDownloadToFileW(NULL, (L"http://fanyi.youdao.com/openapi.do?keyfrom=xujiangtao&key=1490852988&type=data&doctype=json&version=1.1&only=translate&q=" + StrToWstr(UrlEncode(WstrToStr((WCH_command_list[1]))))).c_str(), FilePath.c_str(), 0, NULL);
if (WCH_FileIsBlank(FilePath)) {
throw runtime_error("");
}
Json::Value val;
fin.open(L"WCH_TRANS.tmp");
fin.open(FilePath);
if (!JSON_Reader.parse(fin, val)) {
throw runtime_error("");
}
Expand All @@ -701,7 +703,7 @@ void WCH_trans() {
}
wcout << StrToWstr(val["translation"][0].asString()) << endl;
fin.close();
DeleteFileW(L"WCH_TRANS.tmp");
DeleteFileW(FilePath.c_str());
} catch (...) {
WCH_NetworkError();
return;
Expand All @@ -715,16 +717,17 @@ void WCH_ow() {
return;
}
try {
URLDownloadToFileW(0, L"https://v1.hitokoto.cn/?encode=text", L"WCH_OW.tmp", 0, 0);
if (WCH_FileIsBlank(L"WCH_OW.tmp")) {
wstring FilePath = format(L"{}\\AppData\\Local\\Temp\\WCH_OW.tmp", _wgetenv(L"USERPROFILE"));
URLDownloadToFileW(0, L"https://v1.hitokoto.cn/?encode=text", FilePath.c_str(), 0, 0);
if (WCH_FileIsBlank(FilePath)) {
throw runtime_error("");
}
fin.open(L"WCH_OW.tmp");
fin.open(FilePath);
string res;
getline(fin, res);
wcout << StrToWstr(res) << endl;
fin.close();
DeleteFileW(L"WCH_OW.tmp");
DeleteFileW(FilePath.c_str());
} catch (...) {
WCH_NetworkError();
return;
Expand All @@ -738,12 +741,13 @@ void WCH_fate() {
return;
}
try {
URLDownloadToFileW(NULL, (L"https://api.fanlisky.cn/api/qr-fortune/get/" + StrToWstr(UrlEncode(WstrToStr((WCH_GetUniIdent()))))).c_str(), L"WCH_FATE.tmp", 0, NULL);
if (WCH_FileIsBlank(L"WCH_FATE.tmp")) {
wstring FilePath = format(L"{}\\AppData\\Local\\Temp\\WCH_FATE.tmp", _wgetenv(L"USERPROFILE"));
URLDownloadToFileW(NULL, (L"https://api.fanlisky.cn/api/qr-fortune/get/" + StrToWstr(UrlEncode(WstrToStr((WCH_GetUniIdent()))))).c_str(), FilePath.c_str(), 0, NULL);
if (WCH_FileIsBlank(FilePath)) {
throw runtime_error("");
}
Json::Value val;
fin.open(L"WCH_FATE.tmp");
fin.open(FilePath);
if (!JSON_Reader.parse(fin, val)) {
throw runtime_error("");
}
Expand All @@ -757,7 +761,7 @@ void WCH_fate() {
wcout << StrToWstr(val["data"]["unSignText"].asString()) << endl;
}
fin.close();
DeleteFileW(L"WCH_FATE.tmp");
DeleteFileW(FilePath.c_str());
} catch (...) {
WCH_NetworkError();
return;
Expand All @@ -780,7 +784,7 @@ void WCH_help() {
WCH_InputCommandIncorrect();
return;
}
wstring FilePath = L"resources/" + StrToWstr(WCH_Settings["Language"].asString()) + L"/help.json";
wstring FilePath = WCH_GetExecDir() + L"\\resources\\" + StrToWstr(WCH_Settings["Language"].asString()) + L"\\help.json";
Json::Value val;
WCH_printlog(WCH_LOG_STATUS_INFO, L"Reading file \"" + FilePath + L"\"");
fin.open(FilePath);
Expand All @@ -806,7 +810,7 @@ void WCH_help() {
wcout << StrToWstr((*it).asString()) << endl;
}
if (WCH_command_list[1] == L"config") {
FilePath = L"resources/" + StrToWstr(WCH_Settings["Language"].asString()) + L"/config.json";
FilePath = WCH_GetExecDir() + L"\\resources\\" + StrToWstr(WCH_Settings["Language"].asString()) + L"\\config.json";
Json::Value valcfg;
WCH_printlog(WCH_LOG_STATUS_INFO, L"Reading file \"" + FilePath + L"\"");
fin.open(FilePath);
Expand Down
Loading

0 comments on commit 3a50bc6

Please sign in to comment.