blob: d0718d19c7681ba371407ad6bbfee416c27a3d04 [file] [log] [blame]
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <windows.h>
#include "base/files/file_path.h"
#include "chrome/installer/util/work_item.h"
// A WorkItem subclass that creates a directory with the specified path.
// It also creates all necessary intermediate paths if they do not exist.
class CreateDirWorkItem : public WorkItem {
~CreateDirWorkItem() override;
friend class WorkItem;
explicit CreateDirWorkItem(const base::FilePath& path);
// WorkItem:
bool DoImpl() override;
// Rollback tries to remove all directories created along the path.
// If the leaf directory or one of the intermediate directories are not
// empty, the non-empty directory and its parent directories will not be
// removed.
void RollbackImpl() override;
// Get the top most directory that needs to be created in order to create
// "path_", and set "top_path_" accordingly. if "path_" already exists,
// "top_path_" is set to empty string.
void GetTopDirToCreate();
// Path of the directory to be created.
base::FilePath path_;
// The top most directory that needs to be created.
base::FilePath top_path_;
bool rollback_needed_;