OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 <dirent.h> | 7 #include <dirent.h> |
8 #include <errno.h> | 8 #include <errno.h> |
9 #include <fcntl.h> | 9 #include <fcntl.h> |
10 #include <fnmatch.h> | 10 #include <fnmatch.h> |
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
905 #if defined(OS_ANDROID) | 905 #if defined(OS_ANDROID) |
906 *path = FilePath("/data/local/tmp"); | 906 *path = FilePath("/data/local/tmp"); |
907 #else | 907 #else |
908 *path = FilePath("/tmp"); | 908 *path = FilePath("/tmp"); |
909 #endif | 909 #endif |
910 return true; | 910 return true; |
911 } | 911 } |
912 | 912 |
913 #if !defined(OS_ANDROID) | 913 #if !defined(OS_ANDROID) |
914 bool GetShmemTempDir(FilePath* path) { | 914 bool GetShmemTempDir(FilePath* path) { |
915 #if defined(OS_LINUX) | |
915 *path = FilePath("/dev/shm"); | 916 *path = FilePath("/dev/shm"); |
917 #else | |
918 if (!file_util::GetTempDir(path)) { | |
919 // Set it to /tmp if all else fails. | |
Mark Mentovai
2011/10/24 17:06:12
I would have just made this do |return GetTempDir(
Robert Nagy
2011/10/24 18:00:57
Done.
| |
920 *path = FilePath("/tmp"); | |
921 } | |
922 #endif | |
916 return true; | 923 return true; |
917 } | 924 } |
918 #endif | 925 #endif |
919 | 926 |
920 FilePath GetHomeDir() { | 927 FilePath GetHomeDir() { |
921 const char* home_dir = getenv("HOME"); | 928 const char* home_dir = getenv("HOME"); |
922 if (home_dir && home_dir[0]) | 929 if (home_dir && home_dir[0]) |
923 return FilePath(home_dir); | 930 return FilePath(home_dir); |
924 | 931 |
925 #if defined(OS_ANDROID) | 932 #if defined(OS_ANDROID) |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1053 | 1060 |
1054 allowed_group_ids.insert(group_record->gr_gid); | 1061 allowed_group_ids.insert(group_record->gr_gid); |
1055 } | 1062 } |
1056 | 1063 |
1057 return VerifyPathControlledByUser( | 1064 return VerifyPathControlledByUser( |
1058 kFileSystemRoot, path, kRootUid, allowed_group_ids); | 1065 kFileSystemRoot, path, kRootUid, allowed_group_ids); |
1059 } | 1066 } |
1060 #endif // defined(OS_MACOSX) | 1067 #endif // defined(OS_MACOSX) |
1061 | 1068 |
1062 } // namespace file_util | 1069 } // namespace file_util |
OLD | NEW |