summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/wince/FileSystemWinCE.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/wince/FileSystemWinCE.cpp')
-rw-r--r--WebCore/platform/wince/FileSystemWinCE.cpp42
1 files changed, 12 insertions, 30 deletions
diff --git a/WebCore/platform/wince/FileSystemWinCE.cpp b/WebCore/platform/wince/FileSystemWinCE.cpp
index 49acf12..90b278e 100644
--- a/WebCore/platform/wince/FileSystemWinCE.cpp
+++ b/WebCore/platform/wince/FileSystemWinCE.cpp
@@ -33,25 +33,12 @@
#include "NotImplemented.h"
#include "PlatformString.h"
-#include <wincrypt.h>
-#include <windows.h>
#include <wtf/text/CString.h>
-namespace WebCore {
-
-static size_t reverseFindPathSeparator(const String& path, unsigned start = UINT_MAX)
-{
- size_t positionSlash = path.reverseFind('/', start);
- size_t positionBackslash = path.reverseFind('\\', start);
-
- if (positionSlash == notFound)
- return positionBackslash;
-
- if (positionBackslash == notFound)
- return positionSlash;
+#include <windows.h>
+#include <wincrypt.h>
- return std::max(positionSlash, positionBackslash);
-}
+namespace WebCore {
static bool getFileInfo(const String& path, BY_HANDLE_FILE_INFORMATION& fileInfo)
{
@@ -146,14 +133,14 @@ CString fileSystemRepresentation(const String&)
bool makeAllDirectories(const String& path)
{
- size_t lastDivPos = reverseFindPathSeparator(path);
- unsigned endPos = path.length();
- if (lastDivPos == endPos - 1) {
- --endPos;
- lastDivPos = reverseFindPathSeparator(path, lastDivPos);
+ int lastDivPos = std::max(path.reverseFind('/'), path.reverseFind('\\'));
+ int endPos = path.length();
+ if (lastDivPos == path.length() - 1) {
+ endPos -= 1;
+ lastDivPos = std::max(path.reverseFind('/', lastDivPos), path.reverseFind('\\', lastDivPos));
}
- if (lastDivPos != notFound) {
+ if (lastDivPos > 0) {
if (!makeAllDirectories(path.substring(0, lastDivPos)))
return false;
}
@@ -173,18 +160,13 @@ String homeDirectoryPath()
String pathGetFileName(const String& path)
{
- size_t pos = reverseFindPathSeparator(path);
- if (pos == notFound)
- return path;
- return path.substring(pos + 1);
+ return path.substring(std::max(path.reverseFind('/'), path.reverseFind('\\')) + 1);
}
String directoryName(const String& path)
{
- size_t pos = reverseFindPathSeparator(path);
- if (pos == notFound)
- return String();
- return path.left(pos);
+ notImplemented();
+ return String();
}
CString openTemporaryFile(const char*, PlatformFileHandle& handle)