Make platform-specific #errors occur before platform-specific #includes

Otherwise, there's a cryptic build error about missing headers rather
than a meaningful error when a file is built on the wrong platform.

Change-Id: Ic1637dda5266273007fdf91fb0e7b9979f869c98
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/83130
Auto-Submit: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcrt/fx_folder_posix.cpp b/core/fxcrt/fx_folder_posix.cpp
index 1e4ef9b..33472ee 100644
--- a/core/fxcrt/fx_folder_posix.cpp
+++ b/core/fxcrt/fx_folder_posix.cpp
@@ -6,10 +6,6 @@
 
 #include "core/fxcrt/fx_folder.h"
 
-#include <dirent.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
 #include <memory>
 
 #include "build/build_config.h"
@@ -19,6 +15,10 @@
 #error "built on wrong platform"
 #endif
 
+#include <dirent.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
 struct FX_FolderHandle {
   ByteString m_Path;
   UnownedPtr<DIR> m_Dir;
diff --git a/core/fxcrt/fx_folder_windows.cpp b/core/fxcrt/fx_folder_windows.cpp
index d7a4a23..c35aa84 100644
--- a/core/fxcrt/fx_folder_windows.cpp
+++ b/core/fxcrt/fx_folder_windows.cpp
@@ -6,8 +6,6 @@
 
 #include "core/fxcrt/fx_folder.h"
 
-#include <direct.h>
-
 #include <memory>
 
 #include "build/build_config.h"
@@ -16,6 +14,8 @@
 #error "built on wrong platform"
 #endif
 
+#include <direct.h>
+
 struct FX_FolderHandle {
   HANDLE m_Handle;
   bool m_bReachedEnd;