Index: dir.c
===================================================================
RCS file: /home/cvspublic/apr/file_io/win32/dir.c,v
retrieving revision 1.61
diff -u -r1.61 dir.c
--- dir.c   27 Nov 2001 03:08:58 -0000  1.61
+++ dir.c   28 Jan 2002 12:14:36 -0000
@@ -100,15 +100,16 @@
     (*new)->dirname[len] = '\0';
 
 #if APR_HAS_UNICODE_FS
-    if (apr_os_level >= APR_WIN_NT)
+    APR_OS_IS_UNICODE(apr_os_level)
     {
         /* Create a buffer for the longest file name we will ever see 
          */
         (*new)->w.entry = apr_pcalloc(cont, sizeof(WIN32_FIND_DATAW));
         (*new)->name = apr_pcalloc(cont, APR_FILE_MAX * 3 + 1);        
     }
-    else
 #endif
+#if APR_HAS_ANSI_FS
+    APR_OS_SUPPORT_ANSI
     {
         /* Note that we won't open a directory that is greater than MAX_PATH,
          * including the trailing /* wildcard suffix.  If a * won't fit, then
@@ -122,6 +123,7 @@
         }
         (*new)->n.entry = apr_pcalloc(cont, sizeof(WIN32_FIND_DATAW));
     }
+#endif
     (*new)->rootlen = len - 1;
     (*new)->cntxt = cont;
     (*new)->dirhand = INVALID_HANDLE_VALUE;
@@ -147,7 +149,7 @@
 #if APR_HAS_UNICODE_FS
     apr_wchar_t wdirname[APR_PATH_MAX];
     apr_wchar_t *eos = NULL;
-    if (apr_os_level >= APR_WIN_NT)
+    APR_OS_IS_UNICODE(apr_os_level)
     {
         if (thedir->dirhand == INVALID_HANDLE_VALUE) 
         {
@@ -181,8 +183,9 @@
             return rv;
         fname = thedir->name;
     }
-    else
 #endif
+#if APR_HAS_ANSI_FS
+    APR_OS_SUPPORT_ANSI
     {
         char *eop = strchr(thedir->dirname, '\0');
         if (thedir->dirhand == INVALID_HANDLE_VALUE) {
@@ -208,7 +211,7 @@
         }
         fname = thedir->n.entry->cFileName;
     }
-
+#endif
     fillin_fileinfo(finfo, (WIN32_FILE_ATTRIBUTE_DATA *) thedir->w.entry, 
                     0, wanted);
     finfo->cntxt = thedir->cntxt;
@@ -220,7 +223,7 @@
         /* Go back and get more_info if we can't answer the whole inquiry
          */
 #if APR_HAS_UNICODE_FS
-        if (apr_os_level >= APR_WIN_NT) {
+        APR_OS_IS_UNICODE(apr_os_level) {
             /* Almost all our work is done.  Tack on the wide file name
              * to the end of the wdirname (already / delimited)
              */
@@ -231,13 +234,16 @@
             eos[0] = '\0';
             return rv;
         }
-        else {
+#endif
+#if APR_HAS_ANSI_FS
+        APR_OS_SUPPORT_ANSI
+        {
             /* Don't waste stack space on a second buffer, the one we set
              * aside for the wide directory name is twice what we need.
              */
+#if APR_HAS_UNICODE_FS
             char *fspec = (char*)wdirname;
-#else /* !APR_HAS_UNICODE_FS */
-        {
+#else
             char fspec[APR_PATH_MAX];
 #endif
             int dirlen = strlen(thedir->dirname);
@@ -247,6 +253,7 @@
             apr_cpystrn(fspec + dirlen, fname, sizeof(fspec) - dirlen);
             return more_finfo(finfo, fspec, wanted, MORE_OF_FSPEC);
         }
+#endif
     }
 
     return APR_SUCCESS;
@@ -264,7 +271,7 @@
                                        apr_pool_t *cont)
 {
 #if APR_HAS_UNICODE_FS
-    if (apr_os_level >= APR_WIN_NT) 
+    APR_OS_IS_UNICODE(apr_os_level) 
     {
         apr_wchar_t wpath[APR_PATH_MAX];
         apr_status_t rv;
@@ -276,18 +283,20 @@
             return apr_get_os_error();
         }
     }
-    else
 #endif
+#if APR_HAS_ANSI_FS
+    APR_OS_SUPPORT_ANSI
         if (!CreateDirectory(path, NULL)) {
             return apr_get_os_error();
         }
+#endif
     return APR_SUCCESS;
 }
 
 APR_DECLARE(apr_status_t) apr_dir_remove(const char *path, apr_pool_t *cont)
 {
 #if APR_HAS_UNICODE_FS
-    if (apr_os_level >= APR_WIN_NT) 
+    APR_OS_IS_UNICODE(apr_os_level) 
     {
         apr_wchar_t wpath[APR_PATH_MAX];
         apr_status_t rv;
@@ -299,11 +308,13 @@
             return apr_get_os_error();
         }
     }
-    else
 #endif
+#if APR_HAS_ANSI_FS
+    APR_OS_SUPPORT_ANSI
         if (!RemoveDirectory(path)) {
             return apr_get_os_error();
         }
+#endif
     return APR_SUCCESS;
 }
