ports/devel/electron35/files/patch-chrome_browser_profiles_profile__impl.cc
Hiroki Tagato 3fe2f64857 devel/electron35: add 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/
2025-04-08 21:01:02 +09:00

40 lines
1.5 KiB
C++

--- chrome/browser/profiles/profile_impl.cc.orig 2025-03-24 20:50:14 UTC
+++ chrome/browser/profiles/profile_impl.cc
@@ -270,6 +270,10 @@
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#endif
+#if BUILDFLAG(IS_BSD)
+#include "sandbox/policy/sandbox.h"
+#endif
+
using bookmarks::BookmarkModel;
using content::BrowserThread;
using content::DownloadManagerDelegate;
@@ -594,7 +598,7 @@ void ProfileImpl::LoadPrefsForNormalStartup(bool async
policy_provider = GetUserCloudPolicyManagerAsh();
#else // !BUILDFLAG(IS_CHROMEOS)
{
-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
ProfileManager* profile_manager = g_browser_process->profile_manager();
ProfileAttributesEntry* entry =
profile_manager->GetProfileAttributesStorage()
@@ -892,7 +896,17 @@ base::FilePath ProfileImpl::last_selected_directory()
}
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) {