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"); |
916 return true; | 917 return true; |
| 918 #else |
| 919 return GetTempDir(path); |
| 920 #endif |
917 } | 921 } |
918 #endif | 922 #endif |
919 | 923 |
920 FilePath GetHomeDir() { | 924 FilePath GetHomeDir() { |
921 const char* home_dir = getenv("HOME"); | 925 const char* home_dir = getenv("HOME"); |
922 if (home_dir && home_dir[0]) | 926 if (home_dir && home_dir[0]) |
923 return FilePath(home_dir); | 927 return FilePath(home_dir); |
924 | 928 |
925 #if defined(OS_ANDROID) | 929 #if defined(OS_ANDROID) |
926 LOG(WARNING) << "OS_ANDROID: Home directory lookup not yet implemented."; | 930 LOG(WARNING) << "OS_ANDROID: Home directory lookup not yet implemented."; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 | 1057 |
1054 allowed_group_ids.insert(group_record->gr_gid); | 1058 allowed_group_ids.insert(group_record->gr_gid); |
1055 } | 1059 } |
1056 | 1060 |
1057 return VerifyPathControlledByUser( | 1061 return VerifyPathControlledByUser( |
1058 kFileSystemRoot, path, kRootUid, allowed_group_ids); | 1062 kFileSystemRoot, path, kRootUid, allowed_group_ids); |
1059 } | 1063 } |
1060 #endif // defined(OS_MACOSX) | 1064 #endif // defined(OS_MACOSX) |
1061 | 1065 |
1062 } // namespace file_util | 1066 } // namespace file_util |
OLD | NEW |