ports/devel/electron22/files/patch-chrome_browser_profiles_profile__impl.cc
Mikael Urankar 6a6b89a12f devel/electron22: add new port: Build cross-platform desktop apps with JavaScript, HTML, and CSS
Build cross platform desktop apps with JavaScript, HTML, and CSS.

It's easier than you think.

If you can build a website, you can build a desktop app. Electron is a
framework for creating native applications with web technologies like
JavaScript, HTML, and CSS. It takes care of the hard parts so you can
focus on the core of your application.

WWW: https://electronjs.org/
2023-01-27 17:12:19 +01:00

31 lines
1.1 KiB
C++

--- chrome/browser/profiles/profile_impl.cc.orig 2022-11-30 08:12:58 UTC
+++ chrome/browser/profiles/profile_impl.cc
@@ -258,6 +258,10 @@
#include "chrome/browser/spellchecker/spellcheck_service.h"
#endif
+#if BUILDFLAG(IS_OPENBSD)
+#include "sandbox/policy/openbsd/sandbox_openbsd.h"
+#endif
+
using bookmarks::BookmarkModel;
using content::BrowserThread;
using content::DownloadManagerDelegate;
@@ -839,7 +843,17 @@ void ProfileImpl::DoFinalInit(CreateMode create_mode)
}
base::FilePath ProfileImpl::last_selected_directory() {
+#if BUILDFLAG(IS_OPENBSD)
+ // If unveil(2) is used, force the file dialog directory to something we
+ // know is available.
+ auto* sandbox = sandbox::policy::SandboxLinux::GetInstance();
+ if (sandbox->unveil_initialized())
+ return GetPrefs()->GetFilePath(prefs::kDownloadDefaultDirectory);
+ else
+ return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory);
+#else
return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory);
+#endif
}
void ProfileImpl::set_last_selected_directory(const base::FilePath& path) {