Revision: 4255
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4255&view=rev
Author:   atkac
Date:     2011-02-07 10:46:45 +0000 (Mon, 07 Feb 2011)

Log Message:
-----------
[Development] os: introduce new function called "fileexists"

Modified Paths:
--------------
    trunk/common/os/os.cxx
    trunk/common/os/os.h

Modified: trunk/common/os/os.cxx
===================================================================
--- trunk/common/os/os.cxx      2011-02-07 10:46:16 UTC (rev 4254)
+++ trunk/common/os/os.cxx      2011-02-07 10:46:45 UTC (rev 4255)
@@ -85,3 +85,13 @@
        return 0;
 }
 
+int fileexists(char *file)
+{
+#ifdef WIN32
+  return (GetFileAttributes(file) == INVALID_FILE_ATTRIBUTES) ? -1 : 0;
+#else
+  return access(file, R_OK);
+#endif
+}
+
+

Modified: trunk/common/os/os.h
===================================================================
--- trunk/common/os/os.h        2011-02-07 10:46:16 UTC (rev 4254)
+++ trunk/common/os/os.h        2011-02-07 10:46:45 UTC (rev 4255)
@@ -37,4 +37,13 @@
  */
 int getvnchomedir(char **dirp);
 
+/*
+ * Check if the file exists
+ *
+ * Returns:
+ * 0 - Success
+ * -1 - Failure
+ */
+int fileexists(char *file);
+
 #endif /* OS_OS_H */


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world? 
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
Tigervnc-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tigervnc-commits

Reply via email to