summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/wtf/gobject
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-02-09 14:16:12 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-02-09 14:16:12 +0100
commit03e12282df9aa1e1fb05a8b90f1cfc2e08764cec (patch)
tree52599cd0ab782b1768e23ad176f7618f98333cb6 /Source/JavaScriptCore/wtf/gobject
parentcd44dc59cdfc39534aef4d417e9f3c412e3be139 (diff)
downloadqtwebkit-03e12282df9aa1e1fb05a8b90f1cfc2e08764cec.tar.gz
Imported WebKit commit e09a82039aa4273ab318b71122e92d8e5f233525 (http://svn.webkit.org/repository/webkit/trunk@107223)
Diffstat (limited to 'Source/JavaScriptCore/wtf/gobject')
-rw-r--r--Source/JavaScriptCore/wtf/gobject/GlibUtilities.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/Source/JavaScriptCore/wtf/gobject/GlibUtilities.cpp b/Source/JavaScriptCore/wtf/gobject/GlibUtilities.cpp
index 6fcd806eb..1a2a8b1f1 100644
--- a/Source/JavaScriptCore/wtf/gobject/GlibUtilities.cpp
+++ b/Source/JavaScriptCore/wtf/gobject/GlibUtilities.cpp
@@ -20,8 +20,13 @@
#include "config.h"
#include "GlibUtilities.h"
+#if OS(WINDOWS)
+#include <windows.h>
+#include <wtf/text/WTFString.h>
+#else
#include <limits.h>
#include <unistd.h>
+#endif
#if OS(LINUX)
CString getCurrentExecutablePath()
@@ -41,4 +46,15 @@ CString getCurrentExecutablePath()
return CString();
return CString(readLinkBuffer, result);
}
+#elif OS(WINDOWS)
+CString getCurrentExecutablePath()
+{
+ static WCHAR buffer[MAX_PATH];
+ DWORD length = GetModuleFileNameW(0, buffer, MAX_PATH);
+ if (!length || (length == MAX_PATH && GetLastError() == ERROR_INSUFFICIENT_BUFFER))
+ return CString();
+
+ String path(buffer, length);
+ return path.utf8();
+}
#endif