summaryrefslogtreecommitdiffstats
path: root/base/file_util_win.cc
diff options
context:
space:
mode:
authorerikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-08 20:16:08 +0000
committererikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-08 20:16:08 +0000
commit5af2edb98c8ebde32dcc51dcde9b02bea82468a3 (patch)
tree8e575497f7343fd6eca212253c4fad33bc5cfb68 /base/file_util_win.cc
parent764be58b4a7cc20271571be59118d260aad13966 (diff)
downloadchromium_src-5af2edb98c8ebde32dcc51dcde9b02bea82468a3.zip
chromium_src-5af2edb98c8ebde32dcc51dcde9b02bea82468a3.tar.gz
chromium_src-5af2edb98c8ebde32dcc51dcde9b02bea82468a3.tar.bz2
* add base_paths_mac.mm to mac port
* add file_util_posix.cc to mac port (NOTE: untested on linux) * a bit of cleanup in path_service.cc related to this * a few more cleanups to file_util.cc to make it build for mac git-svn-id: svn://svn.chromium.org/chrome/trunk/src@589 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_win.cc')
-rw-r--r--base/file_util_win.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index a9d0b0b..251d030 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -42,6 +42,19 @@
namespace file_util {
+std::wstring GetDirectoryFromPath(const std::wstring& path) {
+ wchar_t path_buffer[MAX_PATH];
+ wchar_t* file_ptr = NULL;
+ if (GetFullPathName(path.c_str(), MAX_PATH, path_buffer, &file_ptr) == 0)
+ return L"";
+
+ std::wstring::size_type length =
+ file_ptr ? file_ptr - path_buffer : path.length();
+ std::wstring directory(path, 0, length);
+ TrimTrailingSeparator(&directory);
+ return directory;
+}
+
int CountFilesCreatedAfter(const std::wstring& path,
const FILETIME& comparison_time) {
int file_count = 0;
@@ -644,4 +657,4 @@ std::wstring FileEnumerator::Next() {
return (file_type_ & FileEnumerator::FILES) ? cur_file : Next();
}
-} // namespace
+} // namespace file_util