Skip to content

Commit b39c84f

Browse files
committed
IO (Android): fix compiler errors if wordexp is not available
1 parent 0291f35 commit b39c84f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/common/io/io_unix.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
#include "io.h"
22
#include "util/stringUtils.h"
3+
#include "util/unused.h"
34

45
#include <fcntl.h>
56
#include <sys/stat.h>
67
#include <termios.h>
78
#include <poll.h>
89
#include <dirent.h>
10+
11+
#if __has_include(<wordexp.h>)
912
#include <wordexp.h>
13+
#endif
1014

1115
static void createSubfolders(const char* fileName)
1216
{
@@ -108,9 +112,12 @@ bool ffPathExists(const char* path, FFPathType type)
108112
return false;
109113
}
110114

111-
bool ffPathExpandEnv(const char* in, FFstrbuf* out)
115+
bool ffPathExpandEnv(FF_MAYBE_UNUSED const char* in, FF_MAYBE_UNUSED FFstrbuf* out)
112116
{
113117
bool result = false;
118+
119+
#if __has_include(<wordexp.h>) // https://github.com/termux/termux-packages/pull/7056
120+
114121
wordexp_t exp;
115122
if(wordexp(in, &exp, WRDE_NOCMD) != 0)
116123
return false;
@@ -123,6 +130,8 @@ bool ffPathExpandEnv(const char* in, FFstrbuf* out)
123130

124131
wordfree(&exp);
125132

133+
#endif
134+
126135
return result;
127136
}
128137

0 commit comments

Comments
 (0)