Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: base/file_util_linux.cc

Issue 12489: Remove file_util::kPathSeparator from posix. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/file_util.cc ('k') | base/file_util_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/file_util.h" 5 #include "base/file_util.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 15
16 namespace file_util { 16 namespace file_util {
17 17
18 const wchar_t kPathSeparator = L'/';
19
20 bool GetTempDir(FilePath* path) { 18 bool GetTempDir(FilePath* path) {
21 const char* tmp = getenv("TMPDIR"); 19 const char* tmp = getenv("TMPDIR");
22 if (tmp) 20 if (tmp)
23 *path = FilePath(tmp); 21 *path = FilePath(tmp);
24 else 22 else
25 *path = FilePath("/tmp"); 23 *path = FilePath("/tmp");
26 return true; 24 return true;
27 } 25 }
28 26
29 bool CopyFile(const FilePath& from_path, const FilePath& to_path) { 27 bool CopyFile(const FilePath& from_path, const FilePath& to_path) {
30 int infile = open(from_path.value().c_str(), O_RDONLY); 28 int infile = open(from_path.value().c_str(), O_RDONLY);
31 if (infile < 0) 29 if (infile < 0)
32 return false; 30 return false;
33 31
34 int outfile = creat(to_path.value().c_str(), 0666); 32 int outfile = creat(to_path.value().c_str(), 0666);
35 if (outfile < 0) { 33 if (outfile < 0) {
36 close(infile); 34 close(infile);
37 return false; 35 return false;
38 } 36 }
39 37
40 const size_t kBufferSize = 32768; 38 const size_t kBufferSize = 32768;
41 std::vector<char> buffer(kBufferSize); 39 std::vector<char> buffer(kBufferSize);
42 bool result = true; 40 bool result = true;
43 41
(...skipping 22 matching lines...) Expand all
66 64
67 if (close(infile) < 0) 65 if (close(infile) < 0)
68 result = false; 66 result = false;
69 if (close(outfile) < 0) 67 if (close(outfile) < 0)
70 result = false; 68 result = false;
71 69
72 return result; 70 return result;
73 } 71 }
74 72
75 } // namespace file_util 73 } // namespace file_util
OLDNEW
« no previous file with comments | « base/file_util.cc ('k') | base/file_util_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698