File tree Expand file tree Collapse file tree 4 files changed +18
-1
lines changed
Expand file tree Collapse file tree 4 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ extern bool fs_mkdir(const char *path);
2727extern bool fs_rmdir (const char *path);
2828extern bool fs_unlink (const char *path);
2929extern bool fs_exists (const char *path);
30+ extern bool fs_writeable (const char *path);
3031extern bool fs_hidden (const char *path);
3132extern bool fs_chdir (const char *path);
3233extern core::String fs_realpath (const char *path);
Original file line number Diff line number Diff line change @@ -33,6 +33,10 @@ bool fs_exists(const char *path) {
3333 return false ;
3434}
3535
36+ bool fs_writeable (const char *path) {
37+ return false ;
38+ }
39+
3640bool fs_chdir (const char *path) {
3741 return false ;
3842}
Original file line number Diff line number Diff line change @@ -281,6 +281,10 @@ core::String fs_readlink(const char *path) {
281281 return buf;
282282}
283283
284+ bool fs_writeable (const char *path) {
285+ return access (path, W_OK) == 0 ;
286+ }
287+
284288static int fs_scandir_filter (const struct dirent *dent) {
285289 return strcmp (dent->d_name , " ." ) != 0 && strcmp (dent->d_name , " .." ) != 0 ;
286290}
Original file line number Diff line number Diff line change @@ -135,14 +135,22 @@ bool fs_hidden(const char *path) {
135135bool fs_exists (const char *path) {
136136 WCHAR *wpath = io_UTF8ToStringW (path);
137137 priv::denormalizePath (wpath);
138- const int ret = _waccess (wpath, 00 );
138+ const int ret = _waccess (wpath, 0 );
139139 SDL_free (wpath);
140140 if (ret != 0 ) {
141141 Log::debug (" Failed to access %s: %s" , path, strerror (errno));
142142 }
143143 return ret == 0 ;
144144}
145145
146+ bool fs_writeable (const char *path) {
147+ WCHAR *wpath = io_UTF8ToStringW (path);
148+ priv::denormalizePath (wpath);
149+ const int ret = _waccess (wpath, 2 );
150+ SDL_free (wpath);
151+ return ret == 0 ;
152+ }
153+
146154bool fs_chdir (const char *path) {
147155 WCHAR *wpath = io_UTF8ToStringW (path);
148156 priv::denormalizePath (wpath);
You can’t perform that action at this time.
0 commit comments