]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/filefn.cpp
removed wxLoadBitmap() introduced in 1.37 -> 1.38; just use DIBs under Windows CE...
[wxWidgets.git] / src / common / filefn.cpp
index b7ce5c09ec5311cb028530af30751414a87d3f8d..876619c2c7eb3d119e837001cc4ca0c6b8e35a32 100644 (file)
     #endif // __GNUWIN32__
 #endif // __WINDOWS__
 
+#if defined __VMS__
+    #include <fab.h>
+#endif
+
 // TODO: Borland probably has _wgetcwd as well?
 #ifdef _MSC_VER
     #define HAVE_WGETCWD
@@ -1852,6 +1856,51 @@ bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special )
         }
 }
 
+// Return the type of an open file
+//
+wxFileKind wxGetFileKind(int fd)
+{
+#if !defined (__WXWINCE__)
+    if (isatty(fd))
+        return wxFILE_KIND_TERMINAL;
+#endif
+
+#if defined __WXWINCE__
+    return wxFILE_KIND_UNKNOWN;
+#elif defined __WXMSW__
+    switch (::GetFileType(wxGetOSFHandle(fd)) & ~FILE_TYPE_REMOTE)
+    {
+        case FILE_TYPE_DISK:
+            return wxFILE_KIND_DISK;
+        case FILE_TYPE_PIPE:
+            return wxFILE_KIND_PIPE;
+    }
+
+    return wxFILE_KIND_UNKNOWN;
+
+#elif defined __UNIX__
+    struct stat st;
+    fstat(fd, &st);
+
+    if (S_ISFIFO(st.st_mode))
+        return wxFILE_KIND_PIPE;
+    if (!S_ISREG(st.st_mode))
+        return wxFILE_KIND_UNKNOWN;
+
+    #if defined __VMS__
+        if (st.st_fab_rfm != FAB$C_STMLF)
+            return wxFILE_KIND_UNKNOWN;
+    #endif
+
+    return wxFILE_KIND_DISK;
+
+#else
+    if (lseek(fd, 0, SEEK_CUR) != -1)
+        return wxFILE_KIND_DISK;
+    else
+        return wxFILE_KIND_UNKNOWN;
+#endif
+}
 
 #ifdef __VISUALC__
     #pragma warning(default:4706)   // assignment within conditional expression