File tree 2 files changed +35
-0
lines changed
2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -69,5 +69,25 @@ std::string get_runtime_library_header_dir()
69
69
return get_runtime_library_dir () + " /impure" ;
70
70
}
71
71
72
+ bool is_directory (std::string path) {
73
+ struct stat buffer;
74
+ if (stat (path.c_str (), &buffer) == 0 ) {
75
+ if (S_ISDIR (buffer.st_mode )) {
76
+ return true ;
77
+ } else {
78
+ return false ;
79
+ }
80
+ }
81
+ return false ;
82
+ }
83
+
84
+ bool path_exits (std::string path) {
85
+ struct stat buffer;
86
+ if (stat (path.c_str (), &buffer) == 0 ) {
87
+ return true ;
88
+ } else {
89
+ return false ;
90
+ }
91
+ }
72
92
73
93
}
Original file line number Diff line number Diff line change 4
4
#include < string>
5
5
#include < libasr/utils.h>
6
6
7
+ #include < sys/types.h>
8
+ #include < sys/stat.h>
9
+ #ifndef _WIN32
10
+ #include < unistd.h>
11
+ #endif
12
+
13
+ #ifdef _WIN32
14
+ #define stat _stat
15
+ #if !defined S_ISDIR
16
+ #define S_ISDIR (m ) (((m) & _S_IFDIR) == _S_IFDIR)
17
+ #endif
18
+ #endif
19
+
7
20
namespace LFortran {
8
21
9
22
void get_executable_path (std::string &executable_path, int &dirname_length);
10
23
std::string get_runtime_library_dir ();
11
24
std::string get_runtime_library_header_dir ();
25
+ bool is_directory (std::string path);
26
+ bool path_exits (std::string path);
12
27
13
28
} // LFortran
14
29
You can’t perform that action at this time.
0 commit comments