]> wimlib.net Git - wimlib/commitdiff
Move realpath() to win32.c
authorEric Biggers <ebiggers3@gmail.com>
Sun, 17 Mar 2013 21:35:23 +0000 (16:35 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Sun, 17 Mar 2013 21:35:23 +0000 (16:35 -0500)
src/wim.c
src/win32.c
src/win32.h

index 1ffc3fef442dccb5e0760bcd28db5f3cbbd99a31..70e8e73bcfde117136bf56aa8f5f75781a145b26 100644 (file)
--- a/src/wim.c
+++ b/src/wim.c
 
 #include "config.h"
 
 
 #include "config.h"
 
-#ifdef __WIN32__
-#      include <windows.h>
-#      ifdef ERROR
-#              undef ERROR
-#      endif
-#endif
-
+#include <errno.h>
+#include <fcntl.h>
 #include <limits.h>
 #include <limits.h>
-#include <stdlib.h>
 #include <stdarg.h>
 #include <stdarg.h>
-#include <errno.h>
-
-#include "dentry.h"
+#include <stdlib.h>
 #include <unistd.h>
 #include <unistd.h>
-#include <fcntl.h>
 
 #ifdef WITH_NTFS_3G
 
 #ifdef WITH_NTFS_3G
-#include <time.h>
-#include <ntfs-3g/volume.h>
+#  include <time.h>
+#  include <ntfs-3g/volume.h>
+#endif
+
+#ifdef __WIN32__
+#  include "win32.h"
 #endif
 
 #endif
 
-#include "wimlib_internal.h"
 #include "buffer_io.h"
 #include "buffer_io.h"
+#include "dentry.h"
 #include "lookup_table.h"
 #include "lookup_table.h"
+#include "wimlib_internal.h"
 #include "xml.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);
 static int image_print_metadata(WIMStruct *w)
 {
        DEBUG("Printing metadata for image %d", w->current_image);
index e2dc6a1b4396c2152413700b855232235d379fde..775e782eedd9d576e8f6cdd72431948eb22db823 100644 (file)
@@ -1214,3 +1214,27 @@ unsigned win32_get_number_of_processors()
        GetSystemInfo(&sysinfo);
        return sysinfo.dwNumberOfProcessors;
 }
        GetSystemInfo(&sysinfo);
        return sysinfo.dwNumberOfProcessors;
 }
+
+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;
+}
index e702d69a9a5b55c7b37e4b6cf1d4c9a56f0166ac..084eb6b236fbe0d265a0929e4ba5fcd6aa2b4a28 100644 (file)
@@ -50,4 +50,6 @@ extern int fsync(int fd);
 
 extern unsigned win32_get_number_of_processors();
 
 
 extern unsigned win32_get_number_of_processors();
 
+extern char *realpath(const char *path, char *resolved_path);
+
 #endif /* _WIMLIB_WIN32_H */
 #endif /* _WIMLIB_WIN32_H */