From fde9e5efb2d2098453d8229ef87af5fa96156010 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi
Date: Mon, 11 Oct 2021 12:19:39 +0300
Subject: [PATCH 1/1] FileInfo: Check if directory entries are writable
include/the_Foundation/fileinfo.h | 1 +
src/fileinfo.c | 9 ++++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/include/the_Foundation/fileinfo.h b/include/the_Foundation/fileinfo.h
index 08aa356..17ca697 100644
--- a/include/the_Foundation/fileinfo.h
+++ b/include/the_Foundation/fileinfo.h
@@ -47,6 +47,7 @@ iBool exists_FileInfo (const iFileInfo *);
const iString * path_FileInfo (const iFileInfo *);
size_t size_FileInfo (const iFileInfo *);
iBool isDirectory_FileInfo (const iFileInfo *);
+iBool isWritable_FileInfo (const iFileInfo *);
iTime lastModified_FileInfo (const iFileInfo *);
iBool fileExists_FileInfo (const iString *path);
diff --git a/src/fileinfo.c b/src/fileinfo.c
index b54ad5e..6d753db 100644
--- a/src/fileinfo.c
+++ b/src/fileinfo.c
@@ -68,6 +68,7 @@ static int access(const char *path, int mode) {
enum FileInfoFlags {
exists_FileInfoFlag = iBit(1),
directory_FileInfoFlag = iBit(2),
};
struct Impl_FileInfo {
@@ -136,8 +137,10 @@ static iBool initDirEntry_FileInfo_(iFileInfo *d, const iString *dirPath, struct
set_String(d->path, full);
delete_String(full);
deinit_String(&entryName);
d->flags = exists_FileInfoFlag;
d->flags |= writable_FileInfoFlag;
#if defined (iPlatformHaiku)
struct stat s;
stat(ent->d_name, &s);
@@ -176,6 +179,10 @@ size_t size_FileInfo(const iFileInfo *d) {
iBool isDirectory_FileInfo(const iFileInfo *d) {
return (d->flags & directory_FileInfoFlag) != 0;
}
+iBool isWritable_FileInfo(const iFileInfo *d) {
+}
iTime lastModified_FileInfo(const iFileInfo *d) {
if (!isValid_Time(&d->lastModified)) {
--
2.25.1
text/plain
This content has been proxied by September (ba2dc).