file_util_deprecated.h revision ddb351dbec246cf1fab5ec20d2d5520909041de1
1// Copyright (c) 2011 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// We're trying to transition away from paths as wstrings into using
6// FilePath objects.  This file contains declarations of deprecated
7// functions.  By hiding them here rather in the main header, we hope
8// to discourage callers.
9
10// See file_util.h for documentation on all functions that don't have
11// documentation here.
12
13#ifndef BASE_FILE_UTIL_DEPRECATED_H_
14#define BASE_FILE_UTIL_DEPRECATED_H_
15#pragma once
16
17#include "base/base_api.h"
18#include "build/build_config.h"
19
20// We've successfully deprecated all of these functions on non-Windows
21// platforms.
22
23#if defined(OS_WIN)
24
25namespace file_util {
26
27// Use the FilePath versions instead.
28BASE_API FILE* OpenFile(const std::string& filename, const char* mode);
29BASE_API FILE* OpenFile(const std::wstring& filename, const char* mode);
30
31// Appends new_ending to path, adding a separator between the two if necessary.
32BASE_API void AppendToPath(std::wstring* path, const std::wstring& new_ending);
33
34// Use FilePath::Extension instead.
35BASE_API FilePath::StringType GetFileExtensionFromPath(const FilePath& path);
36BASE_API std::wstring GetFileExtensionFromPath(const std::wstring& path);
37
38// Use version that takes a FilePath.
39BASE_API bool Delete(const std::wstring& path, bool recursive);
40BASE_API bool CopyDirectory(const std::wstring& from_path,
41                            const std::wstring& to_path,
42                            bool recursive);
43BASE_API int ReadFile(const std::wstring& filename, char* data, int size);
44BASE_API int WriteFile(const std::wstring& filename,
45                       const char* data, int size);
46
47}
48
49#endif  // OS_WIN
50
51#endif  // BASE_FILE_UTIL_DEPRECATED_H_
52