Don't use base::DIR_APP_DATA on Linux
It doesn't exist. Instead, match content_shell by putting application-specific data in $XDG_CONFIG_HOME or ~/.config.
This commit is contained in:
		
					parent
					
						
							
								22ea2073df
							
						
					
				
			
			
				commit
				
					
						9638e3956f
					
				
			
		
					 1 changed files with 13 additions and 0 deletions
				
			
		| 
						 | 
					@ -9,6 +9,7 @@
 | 
				
			||||||
#include "browser/network_delegate.h"
 | 
					#include "browser/network_delegate.h"
 | 
				
			||||||
#include "common/application_info.h"
 | 
					#include "common/application_info.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "base/environment.h"
 | 
				
			||||||
#include "base/files/file_path.h"
 | 
					#include "base/files/file_path.h"
 | 
				
			||||||
#include "base/path_service.h"
 | 
					#include "base/path_service.h"
 | 
				
			||||||
#include "base/prefs/json_pref_store.h"
 | 
					#include "base/prefs/json_pref_store.h"
 | 
				
			||||||
| 
						 | 
					@ -20,6 +21,10 @@
 | 
				
			||||||
#include "content/public/browser/storage_partition.h"
 | 
					#include "content/public/browser/storage_partition.h"
 | 
				
			||||||
#include "url_request_context_getter.h"
 | 
					#include "url_request_context_getter.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(OS_LINUX)
 | 
				
			||||||
 | 
					#include "base/nix/xdg_util.h"
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace brightray {
 | 
					namespace brightray {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class BrowserContext::ResourceContext : public content::ResourceContext {
 | 
					class BrowserContext::ResourceContext : public content::ResourceContext {
 | 
				
			||||||
| 
						 | 
					@ -83,7 +88,15 @@ base::FilePath BrowserContext::GetPath() {
 | 
				
			||||||
    return path_;
 | 
					    return path_;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  base::FilePath path;
 | 
					  base::FilePath path;
 | 
				
			||||||
 | 
					#if defined(OS_LINUX)
 | 
				
			||||||
 | 
					  scoped_ptr<base::Environment> env(base::Environment::Create());
 | 
				
			||||||
 | 
					  path = base::nix::GetXDGDirectory(env.get(),
 | 
				
			||||||
 | 
					                                    base::nix::kXdgConfigHomeEnvVar,
 | 
				
			||||||
 | 
					                                    base::nix::kDotConfigDir);
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
  CHECK(PathService::Get(base::DIR_APP_DATA, &path));
 | 
					  CHECK(PathService::Get(base::DIR_APP_DATA, &path));
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  path_ = path.Append(base::FilePath::FromUTF8Unsafe(GetApplicationName()));
 | 
					  path_ = path.Append(base::FilePath::FromUTF8Unsafe(GetApplicationName()));
 | 
				
			||||||
  return path_;
 | 
					  return path_;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue