Pull file type during open.

This commit is contained in:
Michael Jumper 2013-08-01 13:44:30 -07:00
parent 06a18f6766
commit 117e9053f4
2 changed files with 32 additions and 0 deletions

View File

@ -210,10 +210,19 @@ int guac_rdpdr_fs_open(guac_rdpdr_device* device, const char* path,
/* Attempt to pull file information */
if (fstat(fd, &file_stat) == 0) {
/* Load size and times */
file->size = file_stat.st_size;
file->ctime = file_stat.st_ctime;
file->mtime = file_stat.st_mtime;
file->atime = file_stat.st_atime;
/* Set type */
if (S_ISDIR(file_stat.st_mode))
file->type = GUAC_RDPDR_FS_DIRECTORY;
else
file->type = GUAC_RDPDR_FS_FILE;
}
/* If information cannot be retrieved, fake it */
@ -227,6 +236,7 @@ int guac_rdpdr_fs_open(guac_rdpdr_device* device, const char* path,
file->ctime = 0;
file->mtime = 0;
file->atime = 0;
file->type = GUAC_RDPDR_FS_FILE;
}

View File

@ -138,11 +138,33 @@
*/
#define WINDOWS_TIME(t) ((t - ((uint64_t) 11644473600)) * 10000000)
/**
* Enumeration of all supported file types.
*/
typedef enum guac_rdpdr_fs_file_type {
/**
* A regular file.
*/
GUAC_RDPDR_FS_FILE,
/**
* A directory.
*/
GUAC_RDPDR_FS_DIRECTORY
} guac_rdpdr_fs_file_type;
/**
* An arbitrary file on the virtual filesystem of the Guacamole drive.
*/
typedef struct guac_rdpdr_fs_file {
/**
* The type of this file.
*/
guac_rdpdr_fs_file_type type;
/**
* Associated local file descriptor.
*/