diff --git a/FCHost/fchost/CMakeLists.txt b/FCHost/fchost/CMakeLists.txt
index e61d463962e1a06209c4d30f585b7f402c8d601c..e9795108fa1cba1bcbb3b05a185dc942c1ecbebe 100644
--- a/FCHost/fchost/CMakeLists.txt
+++ b/FCHost/fchost/CMakeLists.txt
@@ -16,6 +16,8 @@ set(FCHOST_SRCS
   fchost_storage.h
   fchost_storage_js.cc
   fchost_storage_js.h
+  utility.cc
+  utility.h
   )
 set(FCHOST_SRCS_LINUX
   fchost_linux.cc
diff --git a/FCHost/fchost/fchost_app.cc b/FCHost/fchost/fchost_app.cc
index b15304c1594101e8fb2b807e417e1496d6b8ab90..3c5608a42c6df6bb977f6d9f5fcaeface4e3dab5 100644
--- a/FCHost/fchost/fchost_app.cc
+++ b/FCHost/fchost/fchost_app.cc
@@ -4,6 +4,8 @@
 
 #include "fchost_app.h"
 
+#include "./utility.h"
+
 #include "include/cef_browser.h"
 #include "include/cef_command_line.h"
 #include "include/views/cef_browser_view.h"
@@ -156,5 +158,42 @@ void FCHostApp::OnContextInitialized() {
 }
 
 void FCHostApp::OnContextCreated(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Context> context) {
-	FCHostStorageRegister(GetLocalStorePath().ToWString() + L"/FCHostPersistentStorage", context->GetGlobal());
+	FCHostStorageRegister(GetLocalStorePath() / "FCHostPersistentStorage", context->GetGlobal());
+}
+
+int FCHostApp::main(const CefMainArgs& args, CefCommandLine* commandLine)
+{
+  // It will create the first browser instance in OnContextInitialized() after
+  // CEF has initialized.
+  CefRefPtr<FCHostApp> app(new FCHostApp);
+
+  // Specify CEF global settings here.
+  CefSettings settings;
+
+  if (commandLine->HasSwitch("enable-chrome-runtime")) {
+    // Enable experimental Chrome runtime. See issue #2969 for details.
+    settings.chrome_runtime = true;
+  }
+
+  // Cache location is required for local storage
+  cef_string_from_path(app->GetLocalStorePath(), &settings.cache_path);
+
+  // When generating projects with CMake the CEF_USE_SANDBOX value will be defined
+  // automatically. Pass -DUSE_SANDBOX=OFF to the CMake command-line to disable
+  // use of the sandbox.
+#if !defined(CEF_USE_SANDBOX)
+    settings.no_sandbox = true;
+#endif
+
+  // Initialize CEF for the browser process.
+  CefInitialize(args, settings, app.get(), nullptr);
+
+  // Run the CEF message loop. This will block until CefQuitMessageLoop() is
+  // called.
+  CefRunMessageLoop();
+
+  // Shut down CEF.
+  CefShutdown();
+
+  return 0;
 }
diff --git a/FCHost/fchost/fchost_app.h b/FCHost/fchost/fchost_app.h
index 8bf313132667d5c89601a7dead7c7b8b1dd555b8..52887c8754c9392be693b16d7228d7792cc8f93c 100644
--- a/FCHost/fchost/fchost_app.h
+++ b/FCHost/fchost/fchost_app.h
@@ -6,11 +6,14 @@
 
 #include "include/cef_app.h"
 
+#include <filesystem>
+
+class CefMainArgs;
+class CefCommandLine;
+
 // Implement application-level callbacks for the browser process.
 class FCHostApp : public CefApp, public CefBrowserProcessHandler, public CefRenderProcessHandler {
  public:
-  FCHostApp();
-
   // CefApp methods:
   virtual CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler()
       OVERRIDE {
@@ -25,9 +28,12 @@ class FCHostApp : public CefApp, public CefBrowserProcessHandler, public CefRend
   virtual void OnContextInitialized() OVERRIDE;
   virtual void OnContextCreated(CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Context> context) OVERRIDE;
 
-  CefString GetLocalStorePath();
+  std::filesystem::path GetLocalStorePath();
+
+  static int main(const CefMainArgs& args, CefCommandLine* commandLine);
 
  private:
+  FCHostApp();
   // Include the default reference counting implementation.
   IMPLEMENT_REFCOUNTING(FCHostApp);
 };
diff --git a/FCHost/fchost/fchost_handler.cc b/FCHost/fchost/fchost_handler.cc
index 95eec1b6e56592ccd2c081c94b970ed189bfbef1..818538ca5bca76045fa31057e16f05bf43a0c44d 100644
--- a/FCHost/fchost/fchost_handler.cc
+++ b/FCHost/fchost/fchost_handler.cc
@@ -209,9 +209,9 @@ bool FCHostHandler::OnPreKeyEvent(CefRefPtr<CefBrowser> browser,
   #if defined (OS_WIN)
 			windowInfo.SetAsPopup(browser->GetHost()->GetWindowHandle(), "DevTools");
   #elif defined(OS_LINUX)
-      windowInfo.SetAsChild(browser->GetHost()->GetWindowHandle(), CefRect(100, 100, 800, 600));
+			windowInfo.SetAsChild(browser->GetHost()->GetWindowHandle(), CefRect(100, 100, 800, 600));
   #else
-    #error "Platform-specific code required"
+			#error "Platform-specific code required"
   #endif
 			browser->GetHost()->ShowDevTools(windowInfo, browser->GetHost()->GetClient(), settings, point);
 
diff --git a/FCHost/fchost/fchost_linux.cc b/FCHost/fchost/fchost_linux.cc
index 837df28715be7c8b36e0aad937a9993c716c9b5a..c79746c89682c557f2b419efce9097901ece0ae5 100644
--- a/FCHost/fchost/fchost_linux.cc
+++ b/FCHost/fchost/fchost_linux.cc
@@ -13,11 +13,9 @@
 
 #include <filesystem>
 
-CefString FCHostApp::GetLocalStorePath()
+std::filesystem::path FCHostApp::GetLocalStorePath()
 {
-  std::filesystem::path ret = std::filesystem::path{getenv("HOME")} / ".local" / "share" / "FreeCities_Pregmod";
-
-	return CefString(ret.string());
+  return std::filesystem::path{getenv("HOME")} / ".local" / "share" / "FreeCities_Pregmod";
 }
 
 #if defined(CEF_X11)
@@ -62,42 +60,8 @@ int main(int argc, char* argv[]) {
   XSetIOErrorHandler(XIOErrorHandlerImpl);
 #endif
 
-  // Parse command-line arguments for use in this method.
   CefRefPtr<CefCommandLine> command_line = CefCommandLine::CreateCommandLine();
   command_line->InitFromArgv(argc, argv);
 
-  // It will create the first browser instance in OnContextInitialized() after
-  // CEF has initialized.
-  CefRefPtr<FCHostApp> app(new FCHostApp);
-
-  // Specify CEF global settings here.
-  CefSettings settings;
-
-  if (command_line->HasSwitch("enable-chrome-runtime")) {
-    // Enable experimental Chrome runtime. See issue #2969 for details.
-    settings.chrome_runtime = true;
-  }
-
-  // Cache location is required for local storage
-  CefString local_storage = app->GetLocalStorePath();
-  cef_string_from_utf16(local_storage.c_str(), local_storage.length(), &settings.cache_path);
-
-// When generating projects with CMake the CEF_USE_SANDBOX value will be defined
-// automatically. Pass -DUSE_SANDBOX=OFF to the CMake command-line to disable
-// use of the sandbox.
-#if !defined(CEF_USE_SANDBOX)
-  settings.no_sandbox = true;
-#endif
-
-  // Initialize CEF for the browser process.
-  CefInitialize(main_args, settings, app.get(), nullptr);
-
-  // Run the CEF message loop. This will block until CefQuitMessageLoop() is
-  // called.
-  CefRunMessageLoop();
-
-  // Shut down CEF.
-  CefShutdown();
-
-  return 0;
+  return FCHostApp::main(main_args, command_line);
 }
diff --git a/FCHost/fchost/fchost_storage.cc b/FCHost/fchost/fchost_storage.cc
index 7326e838cfa1d654c867f9610da783ef4356ed53..7f9c27a6fb1cf99e9c7d71d11689b55db8017ac4 100644
--- a/FCHost/fchost/fchost_storage.cc
+++ b/FCHost/fchost/fchost_storage.cc
@@ -41,12 +41,8 @@ static bool SanitizePath(std::wstring& inpath)
 }
 */
 
-FCHostPersistentStorage::FCHostPersistentStorage(const CefString& _path)
-#if defined(OS_WIN)
-	: path(_path.ToWString())
-#else
-	: path(_path.ToString())
-#endif
+FCHostPersistentStorage::FCHostPersistentStorage(const std::filesystem::path& _path)
+	: path{_path}
 {
 	ensure_folder_exists();
 	load();
diff --git a/FCHost/fchost/fchost_storage.h b/FCHost/fchost/fchost_storage.h
index db036577572d4428add530e5e02b7426057c99ca..c48da54bc1af3555b8e7f3e9b65982373049672a 100644
--- a/FCHost/fchost/fchost_storage.h
+++ b/FCHost/fchost/fchost_storage.h
@@ -34,7 +34,7 @@ class FCHostPersistentStorage : public FCHostSessionStorage
 {
 	using base = FCHostSessionStorage;
 public:
-	FCHostPersistentStorage(const CefString& _path);
+	FCHostPersistentStorage(const std::filesystem::path& _path);
 
 	virtual void set(const CefString& key, CefRefPtr<CefV8Value> val) override;
 	virtual bool remove(const CefString& key) override;
diff --git a/FCHost/fchost/fchost_storage_js.cc b/FCHost/fchost/fchost_storage_js.cc
index d3e76d524c668d8c83ff02f2e2bffaf9592f6f43..8b0374db990f6fc235813c50f2c500802a414b50 100644
--- a/FCHost/fchost/fchost_storage_js.cc
+++ b/FCHost/fchost/fchost_storage_js.cc
@@ -24,7 +24,7 @@ static void AttachStorageFunctions(CefRefPtr<CefV8Value> object, CefRefPtr<CefV8
 	REGJSFUNC("clear");
 }
 
-void FCHostStorageRegister(const CefString& persistPath, CefRefPtr<CefV8Value> object) {
+void FCHostStorageRegister(const std::filesystem::path& persistPath, CefRefPtr<CefV8Value> object) {
 	// New context, reset everything (don't try to run more than one app at once!)
 	if (persist) persist.reset(NULL);
 	if (session) session.reset(NULL);
diff --git a/FCHost/fchost/fchost_storage_js.h b/FCHost/fchost/fchost_storage_js.h
index cf40c48a05d5923fc56d1fd480c8c9cbb4459395..bb948eb5a18ffea41953373972e14d2d2c0e64b2 100644
--- a/FCHost/fchost/fchost_storage_js.h
+++ b/FCHost/fchost/fchost_storage_js.h
@@ -20,4 +20,4 @@ private:
 	IMPLEMENT_REFCOUNTING(FCHostStorageHandler);
 };
 
-void FCHostStorageRegister(const CefString& persistPath, CefRefPtr<CefV8Value> object);
+void FCHostStorageRegister(const std::filesystem::path& persistPath, CefRefPtr<CefV8Value> object);
diff --git a/FCHost/fchost/fchost_win.cc b/FCHost/fchost/fchost_win.cc
index 0e3a3f119f7aff309aa2fabe536c4f1e392fc90c..575f5340fb012c41da15eb9d481c046ec879902b 100644
--- a/FCHost/fchost/fchost_win.cc
+++ b/FCHost/fchost/fchost_win.cc
@@ -8,14 +8,13 @@
 
 #include "fchost_app.h"
 
-CefString FCHostApp::GetLocalStorePath()
+std::filesystem::path FCHostApp::GetLocalStorePath()
 {
 	PWSTR ppath;
 	SHGetKnownFolderPath(FOLDERID_Documents, 0, NULL, &ppath);
-	std::wstring local_storage = ppath;
-	local_storage += L"\\FreeCities_Pregmod";
+	std::filesystem::path local_storage = ppath;
 	CoTaskMemFree(ppath);
-	return local_storage.c_str();
+	return local_storage / L"FreeCities_Pregmod";
 }
 
 // Entry point function for all processes.
@@ -32,35 +31,17 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
   // Provide CEF with command-line arguments.
   CefMainArgs main_args(hInstance);
 
-  // It will create the first browser instance in OnContextInitialized() after
-  // CEF has initialized.
-  CefRefPtr<FCHostApp> app(new FCHostApp);
-
   // CEF applications have multiple sub-processes (render, plugin, GPU, etc)
   // that share the same executable. This function checks the command-line and,
   // if this is a sub-process, executes the appropriate logic.
-  int exit_code = CefExecuteProcess(main_args, app.get(), NULL);
+  int exit_code = CefExecuteProcess(main_args, nullptr, nullptr);
   if (exit_code >= 0) {
     // The sub-process has completed so return here.
     return exit_code;
   }
 
-  // Specify CEF global settings here.
-  CefSettings settings;
-
-  // Cache location is required for local storage
-  CefString local_storage = app->GetLocalStorePath();
-  cef_string_from_utf16(local_storage.c_str(), local_storage.length(), &settings.cache_path);
-
-  // Initialize CEF.
-  CefInitialize(main_args, settings, app.get(), NULL);
-
-  // Run the CEF message loop. This will block until CefQuitMessageLoop() is
-  // called.
-  CefRunMessageLoop();
-
-  // Shut down CEF.
-  CefShutdown();
+  CefRefPtr<CefCommandLine> command_line = CefCommandLine::CreateCommandLine();
+  command_line->InitFromString(lpCmdLine);
 
-  return 0;
+  return FCHostApp::main(main_args, command_line);
 }
diff --git a/FCHost/fchost/utility.cc b/FCHost/fchost/utility.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ff7c7cde3a2bfdb3022b2b2dc0db2b79659a9bd4
--- /dev/null
+++ b/FCHost/fchost/utility.cc
@@ -0,0 +1,16 @@
+#include "./utility.h"
+
+CefString cef_string_from_path(const std::filesystem::path& p)
+{
+	return CefString(p.native());
+}
+
+void cef_string_from_path(const std::filesystem::path& p, cef_string_t* str)
+{
+	const auto& pstr = p.native();
+#if defined(OS_WIN)
+	cef_string_from_utf16(pstr.c_str(), pstr.size(), str);
+#else
+	cef_string_from_utf8(pstr.c_str(), pstr.size(), str);
+#endif
+}
diff --git a/FCHost/fchost/utility.h b/FCHost/fchost/utility.h
new file mode 100644
index 0000000000000000000000000000000000000000..83a7ceec599980722010dd74fff8d2fa5bd25f7b
--- /dev/null
+++ b/FCHost/fchost/utility.h
@@ -0,0 +1,8 @@
+#pragma once
+
+#include "include/capi/cef_base_capi.h"
+
+#include <filesystem>
+
+CefString cef_string_from_path(const std::filesystem::path& p);
+void cef_string_from_path(const std::filesystem::path& p, cef_string_t* str);