fix: use correct userData path when unbundled (#30113)

This commit is contained in:
Jeremy Rose 2021-07-14 13:10:37 -07:00 committed by GitHub
parent 4db7221c7d
commit bec47f54f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 32 additions and 36 deletions

View file

@ -136,25 +136,25 @@ void Browser::Shutdown() {
}
std::string Browser::GetVersion() const {
std::string ret = GetOverriddenApplicationVersion();
std::string ret = OverriddenApplicationVersion();
if (ret.empty())
ret = GetExecutableFileVersion();
return ret;
}
void Browser::SetVersion(const std::string& version) {
OverrideApplicationVersion(version);
OverriddenApplicationVersion() = version;
}
std::string Browser::GetName() const {
std::string ret = GetOverriddenApplicationName();
std::string ret = OverriddenApplicationName();
if (ret.empty())
ret = GetExecutableFileProductName();
return ret;
}
void Browser::SetName(const std::string& name) {
OverrideApplicationName(name);
OverriddenApplicationName() = name;
}
int Browser::GetBadgeCount() {

View file

@ -118,11 +118,7 @@ ElectronBrowserContext::ElectronBrowserContext(const std::string& partition,
base::StringToInt(command_line->GetSwitchValueASCII(switches::kDiskCacheSize),
&max_cache_size_);
if (!base::PathService::Get(chrome::DIR_USER_DATA, &path_)) {
base::PathService::Get(DIR_APP_DATA, &path_);
path_ = path_.Append(base::FilePath::FromUTF8Unsafe(GetApplicationName()));
base::PathService::Override(chrome::DIR_USER_DATA, path_);
}
CHECK(base::PathService::Get(chrome::DIR_USER_DATA, &path_));
if (!in_memory && !partition.empty())
path_ = path_.Append(FILE_PATH_LITERAL("Partitions"))