Browse Source

[Development] os: introduce new function called "fileexists"


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4255 3789f03b-4d11-0410-bbf8-ca57d06f2519
tags/v1.0.90
Adam Tkac 13 years ago
parent
commit
c480ee3266
2 changed files with 19 additions and 0 deletions
  1. 10
    0
      common/os/os.cxx
  2. 9
    0
      common/os/os.h

+ 10
- 0
common/os/os.cxx View File

@@ -85,3 +85,13 @@ int getvnchomedir(char **dirp)
return 0;
}

int fileexists(char *file)
{
#ifdef WIN32
return (GetFileAttributes(file) == INVALID_FILE_ATTRIBUTES) ? -1 : 0;
#else
return access(file, R_OK);
#endif
}



+ 9
- 0
common/os/os.h View File

@@ -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 */

Loading…
Cancel
Save