diff --git a/v2/internal/ffenestri/ffenestri_windows.cpp b/v2/internal/ffenestri/ffenestri_windows.cpp index 504000f1..2c53e432 100644 --- a/v2/internal/ffenestri/ffenestri_windows.cpp +++ b/v2/internal/ffenestri/ffenestri_windows.cpp @@ -282,24 +282,20 @@ bool initWebView2(struct Application *app, int debugEnabled, messageCallback cb) std::atomic_flag flag = ATOMIC_FLAG_INIT; flag.test_and_set(); -// char currentExePath[MAX_PATH]; -// GetModuleFileNameA(NULL, currentExePath, MAX_PATH); -// char *currentExeName = PathFindFileNameA(currentExePath); -// std::wstring_convert> wideCharConverter; -// auto exeName = wideCharConverter.from_bytes(currentExeName); -// -// PWSTR path; -// HRESULT appDataResult = SHGetFolderPathAndSubDir(app->window, CSIDL_LOCAL_APPDATA, nullptr, SHGFP_TYPE_CURRENT, exeName.c_str(), path); -// if ( appDataResult == false ) { -// path = nullptr; -// } -// + char currentExePath[MAX_PATH]; + GetModuleFileNameA(NULL, currentExePath, MAX_PATH); + char *currentExeName = PathFindFileNameA(currentExePath); + + std::wstring_convert> wideCharConverter; + std::wstring userDataFolder = + wideCharConverter.from_bytes(std::getenv("APPDATA")); + std::wstring currentExeNameW = wideCharConverter.from_bytes(currentExeName); ICoreWebView2Controller *controller; ICoreWebView2* webview; HRESULT res = CreateCoreWebView2EnvironmentWithOptions( - nullptr, nullptr, nullptr, + nullptr, (userDataFolder + L"/" + currentExeNameW).c_str(), nullptr, new wv2ComHandler(app, app->window, cb, [&](ICoreWebView2Controller *webviewController) { controller = webviewController;