Commit 92f494ea authored by Joel Einbinder's avatar Joel Einbinder Committed by Commit Bot

DevTools: Don't throw an error when filesystems are re-added

This removes and re-adds a filesystem if it was already added instead
of throwing an error. It makes it easier to work with overrides if
you are coming from an old version of overrides or add the folder to
the wrong type of persistence.

Bug: 760316
Change-Id: I8578fef29eba2529ded714cf8bf8582d616c439d
Reviewed-on: https://chromium-review.googlesource.com/820569Reviewed-by: default avatarPavel Feldman <pfeldman@chromium.org>
Commit-Queue: Joel Einbinder <einbinder@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523296}
parent 7b9fe37f
...@@ -56,7 +56,6 @@ namespace { ...@@ -56,7 +56,6 @@ namespace {
static const char kRootName[] = "<root>"; static const char kRootName[] = "<root>";
static const char kPermissionDenied[] = "<permission denied>"; static const char kPermissionDenied[] = "<permission denied>";
static const char kAlreadyAdded[] = "<already added>";
base::LazyInstance<base::FilePath>::Leaky base::LazyInstance<base::FilePath>::Leaky
g_last_save_path = LAZY_INSTANCE_INITIALIZER; g_last_save_path = LAZY_INSTANCE_INITIALIZER;
...@@ -343,10 +342,8 @@ void DevToolsFileHelper::InnerAddFileSystem( ...@@ -343,10 +342,8 @@ void DevToolsFileHelper::InnerAddFileSystem(
const base::FilePath& path) { const base::FilePath& path) {
std::string file_system_path = path.AsUTF8Unsafe(); std::string file_system_path = path.AsUTF8Unsafe();
if (IsFileSystemAdded(file_system_path)) { if (IsFileSystemAdded(file_system_path))
FailedToAddFileSystem(kAlreadyAdded); RemoveFileSystem(file_system_path);
return;
}
std::string path_display_name = path.AsEndingWithSeparator().AsUTF8Unsafe(); std::string path_display_name = path.AsEndingWithSeparator().AsUTF8Unsafe();
base::string16 message = l10n_util::GetStringFUTF16( base::string16 message = l10n_util::GetStringFUTF16(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment