summaryrefslogtreecommitdiff
path: root/common/rt/src/rt_file.cpp
blob: 1b3746e813af97d3e0083dfccde5274aab5496a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/types.h>
#include <dirent.h>

#include "rt_common.h"

int rt_file_exsit(const char *realpath_file)
{
    return (!access(realpath_file, F_OK));
}

int rt_dir_exsit (const char *realpath)
{
    DIR *dir = NULL;
    int exsit = 0;

    if (unlikely (!realpath))
		goto finish;

    dir = opendir(realpath);
    if (!dir) goto finish;

    exsit = 1;
    closedir(dir);
finish:
    return exsit;
}