aboutsummaryrefslogtreecommitdiffhomepage
path: root/qbuffers.cpp
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-11-22 13:53:40 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-11-22 13:53:40 +0100
commit32d9c760b3ad78e6a62c2144647aac0a220c06fb (patch)
tree6b766464179df26abe8707b11f549c1b65eb44f0 /qbuffers.cpp
parent7ac3c26c927d636c0f2331f00d5a5c11aec8a2ff (diff)
downloadsciteco-32d9c760b3ad78e6a62c2144647aac0a220c06fb.tar.gz
Windows (MinGW32) compatibility changes
* mainly we need a custom get_absolute_path() function using Win32 API * also the windows.h conflicts with some other headers (esp. BSD headers) * also there was a typo in the code setting file attributes
Diffstat (limited to 'qbuffers.cpp')
-rw-r--r--qbuffers.cpp37
1 files changed, 30 insertions, 7 deletions
diff --git a/qbuffers.cpp b/qbuffers.cpp
index 64a5fbd..9a12232 100644
--- a/qbuffers.cpp
+++ b/qbuffers.cpp
@@ -3,10 +3,6 @@
#include <string.h>
#include <bsd/sys/queue.h>
-#ifdef G_OS_WIN32
-#include <windows.h>
-#endif
-
#include <glib.h>
#include <glib/gprintf.h>
#include <glib/gstdio.h>
@@ -21,6 +17,16 @@
#include "goto.h"
#include "qbuffers.h"
+#ifdef G_OS_WIN32
+/* here it shouldn't cause conflicts with other headers */
+#include <windows.h>
+
+/* still need to clean up */
+#ifdef interface
+#undef interface
+#endif
+#endif
+
namespace States {
StateEditFile editfile;
StateSaveFile savefile;
@@ -555,7 +561,8 @@ make_savepoint(Buffer *buffer)
token->attributes = GetFileAttributes((LPCTSTR)savepoint);
if (token->attributes != INVALID_FILE_ATTRIBUTES)
SetFileAttributes((LPCTSTR)savepoint,
- attrs | FILE_ATTRIBUTE_HIDDEN);
+ token->attributes |
+ FILE_ATTRIBUTE_HIDDEN);
#endif
undo.push(token);
} else {
@@ -672,16 +679,32 @@ get_absolute_path(const gchar *path)
return resolved;
}
+#elif defined(G_OS_WIN32)
+
+gchar *
+get_absolute_path(const gchar *path)
+{
+ TCHAR buf[MAX_PATH];
+ gchar *resolved = NULL;
+
+ if (GetFullPathName(path, sizeof(buf), buf, NULL))
+ resolved = g_strdup(buf);
+
+ return resolved;
+}
+
#else
+/*
+ * FIXME: I doubt that works on any platform...
+ */
gchar *
get_absolute_path(const gchar *path)
{
- /* FIXME: see Unix implementation */
return path ? g_file_read_link(path, NULL) : NULL;
}
-#endif
+#endif /* !G_OS_UNIX && !G_OS_WIN32 */
/*
* Command states