summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-21 00:05:48 +0000
committerrafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-21 00:05:48 +0000
commit05eb0fa9b4ad18e0ee94db251b1ab47e21850fad (patch)
tree0e230512e40ea41a5b1410b6ee771b07591f299e
parentb563e1e32788d4f3c65c74e5c6e22b38e3c918ac (diff)
downloadchromium_src-05eb0fa9b4ad18e0ee94db251b1ab47e21850fad.zip
chromium_src-05eb0fa9b4ad18e0ee94db251b1ab47e21850fad.tar.gz
chromium_src-05eb0fa9b4ad18e0ee94db251b1ab47e21850fad.tar.bz2
Create the extensions (<Profile>/Extensions) and user script (<Profile>/User Scripts) directories during start up if they don't already exists
Review URL: http://codereview.chromium.org/29001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10134 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/extensions_service.cc5
-rw-r--r--chrome/browser/extensions/user_script_master.cc4
2 files changed, 9 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index c469c08..13d43a5 100644
--- a/chrome/browser/extensions/extensions_service.cc
+++ b/chrome/browser/extensions/extensions_service.cc
@@ -162,6 +162,11 @@ bool ExtensionsServiceBackend::LoadExtensionsFromDirectory(
const FilePath& path_in,
scoped_refptr<ExtensionsServiceFrontendInterface> frontend) {
FilePath path = path_in;
+
+ // Create the <Profile>/Extensions directory if it doesn't exist.
+ if (!file_util::DirectoryExists(path))
+ file_util::CreateDirectory(path);
+
if (!file_util::AbsolutePath(&path))
NOTREACHED();
diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc
index 23ef66f..a6af109 100644
--- a/chrome/browser/extensions/user_script_master.cc
+++ b/chrome/browser/extensions/user_script_master.cc
@@ -147,6 +147,10 @@ base::SharedMemory* UserScriptMaster::ScriptReloader::GetNewScripts(
// Find all the scripts in |script_dir|.
if (!script_dir.value().empty()) {
+ // Create the "<Profile>/User Scripts" directory if it doesn't exist
+ if (!file_util::DirectoryExists(script_dir))
+ file_util::CreateDirectory(script_dir);
+
file_util::FileEnumerator enumerator(script_dir, false,
file_util::FileEnumerator::FILES,
FILE_PATH_LITERAL("*.user.js"));