+2008-04-24 Adele Peterson <adele@apple.com>
+
+ Reviewed by Darin.
+
+ Consolidate two versions of pathGetFileName.
+
+ * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::formData): Call FileSystem.h version of pathGetFileName and removed the static helper function.
+ * platform/posix/FileSystemPOSIX.cpp: (WebCore::pathGetFileName): Moved general case from HTMLFormElement version here.
+ If other platforms relied on that default they should implement this function for their platform specific version of FileSystem.cpp
+ * platform/win/FileSystemWin.cpp: (WebCore::pathGetFileName): Moved win implementation from HTMLFormElement here.
+ * platform/wx/FileSystemWx.cpp: (WebCore::pathGetFileName): Moved wx implementation from HTMLFormElement here.
+
2008-04-24 Anders Carlsson <andersca@apple.com>
Windows build fix.
#include "CSSHelper.h"
#include "Event.h"
#include "EventNames.h"
+#include "FileSystem.h"
#include "FormData.h"
#include "FormDataList.h"
#include "Frame.h"
#endif
}
-// FIXME: Move to platform directory?
-// Warning: this helper doesn't currently have a reliable cross-platform behavior in
-// certain edge cases (see basename(3) specification for examples).
-// Consider this if it ever needs to become a general purpose method.
-static String pathGetFilename(const String& path)
-{
-#if PLATFORM(QT)
- return QFileInfo(path).fileName();
-#elif PLATFORM(WX)
- return wxFileName(path).GetFullName();
-#elif PLATFORM(WIN_OS)
- String copy(path);
- return String(::PathFindFileName(copy.charactersWithNullTermination()));
-#else
- return path.substring(path.reverseFind('/') + 1);
-#endif
-}
-
TextEncoding HTMLFormElement::dataEncoding() const
{
if (isMailtoForm())
if (control->hasLocalName(inputTag)
&& static_cast<HTMLInputElement*>(control)->inputType() == HTMLInputElement::FILE) {
String path = static_cast<HTMLInputElement*>(control)->value();
- String filename = pathGetFilename(path);
+ String filename = pathGetFileName(path);
// FIXME: This won't work if the filename includes a " mark,
// or control characters like CR or LF. This also does strange
String pathGetFileName(const String& path)
{
- return String(PathFindFileName(String(path).charactersWithNullTermination()));
+ return String(::PathFindFileName(String(path).charactersWithNullTermination()));
}
static String bundleName()
return String();
}
-String pathGetFileName(const String&)
+String pathGetFileName(const String& path)
{
- notImplemented();
- return String();
+ return wxFileName(path).GetFullName();
}
CString openTemporaryFile(const char* prefix, PlatformFileHandle& handle)