blob: 579ff0adec505ca4873f4cb18a9955eaa60fd6e8 [file] [log] [blame]
// Copyright 2015 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.
// This file contains utility functions around the mojo files service.
#ifndef MOJO_FILE_UTILS_FILE_UTIL_H_
#define MOJO_FILE_UTILS_FILE_UTIL_H_
#include <string>
#include "mojo/services/files/interfaces/directory.mojom.h"
#include "mojo/services/files/interfaces/file.mojom.h"
namespace file_utils {
// Creates a new temp file, placed in the (input) directory |directory| along
// with the (output) file location in |path_name|. This function blocks the
// calling thread, and there must not be any calls pending on the |directory|
// when this function is called.
// Returns a FilePtr on success, and null on failure.
// On failure, |path_name| is unchanged.
mojo::files::FilePtr CreateTemporaryFileInDir(
mojo::files::DirectoryPtr* directory,
std::string* path_name);
} // namespace file_utils
#endif // MOJO_FILE_UTILS_FILE_UTIL_H_