]> wimlib.net Git - wimlib/blobdiff - src/wim.c
Windows native build
[wimlib] / src / wim.c
index bd31c5b3ea9d1e1f1ee9e6ef262e502586988a5c..1ffc3fef442dccb5e0760bcd28db5f3cbbd99a31 100644 (file)
--- a/src/wim.c
+++ b/src/wim.c
  */
 
 #include "config.h"
+
+#ifdef __WIN32__
+#      include <windows.h>
+#      ifdef ERROR
+#              undef ERROR
+#      endif
+#endif
+
 #include <limits.h>
 #include <stdlib.h>
 #include <stdarg.h>
 #include "lookup_table.h"
 #include "xml.h"
 
+#ifdef __WIN32__
+static char *realpath(const char *path, char *resolved_path)
+{
+       DWORD ret;
+       wimlib_assert(resolved_path == NULL);
+
+       ret = GetFullPathNameA(path, 0, NULL, NULL);
+       if (!ret)
+               goto fail_win32;
+
+       resolved_path = MALLOC(ret + 1);
+       if (!resolved_path)
+               goto fail;
+       ret = GetFullPathNameA(path, ret, resolved_path, NULL);
+       if (!ret) {
+               free(resolved_path);
+               goto fail_win32;
+       }
+       return resolved_path;
+fail_win32:
+       win32_error(GetLastError());
+fail:
+       return NULL;
+}
+#endif
+
 static int image_print_metadata(WIMStruct *w)
 {
        DEBUG("Printing metadata for image %d", w->current_image);