DAV_FS_URI_MYPROPS /* the namespace URI for our custom props */
};
+/*
+** Does this platform support an executable flag?
+**
+** ### need a way to portably abstract this query
+*/
+#ifndef WIN32
+#define DAV_FS_HAS_EXECUTABLE
+#endif
+
/*
** The single property that we define (in the DAV_FS_URI_MYPROPS namespace)
-** XXX this property is not usable (readable/writable) on all platforms
-** Need an abstract way to determine this.
*/
-#ifdef UNIX
#define DAV_PROPID_FS_executable 1
-#endif
static const dav_liveprop_spec dav_fs_props[] =
{
+ /* standard DAV properties */
{
DAV_FS_URI_DAV,
"creationdate",
DAV_PROPID_getlastmodified,
0
},
-#ifdef DAV_PROPID_FS_executable
+
+ /* our custom properties */
{
DAV_FS_URI_MYPROPS,
"executable",
DAV_PROPID_FS_executable,
0 /* handled special in dav_fs_is_writable */
},
-#endif
+
{ 0 } /* sentinel */
};
buf);
value = buf;
break;
-#ifdef DAV_PROPID_FS_executable
+
case DAV_PROPID_FS_executable:
/* our property, but not defined on collection resources */
if (resource->collection)
else
value = "F";
break;
-#endif
+
default:
/* ### what the heck was this property? */
return DAV_PROP_INSERT_NOTDEF;
return what;
}
-#ifdef DAV_PROPID_FS_executable
-
static int dav_fs_is_writable(const dav_resource *resource, int propid)
{
const dav_liveprop_spec *info;
+#ifdef DAV_FS_HAS_EXECUTABLE
+ /* if we have the executable property, and this isn't a collection,
+ then the property is writable. */
if (propid == DAV_PROPID_FS_executable && !resource->collection)
return 1;
+#endif
(void) dav_get_liveprop_info(propid, &dav_fs_liveprop_group, &info);
return info->is_writable;
return NULL;
}
+
static const dav_hooks_liveprop dav_hooks_liveprop_fs =
{
dav_fs_insert_prop,
dav_fs_patch_rollback
};
-#endif /* DAV_PROPID_FS_executable */
-
static const dav_provider dav_fs_provider =
{
&dav_hooks_repository_fs,
void dav_fs_gather_propsets(apr_array_header_t *uris)
{
-#ifdef DAV_PROPID_FS_executable
+#ifdef DAV_FS_HAS_EXECUTABLE
*(const char **)apr_array_push(uris) =
"<http://apache.org/dav/propset/fs/1>";
#endif
what, phdr);
(void) dav_fs_insert_prop(resource, DAV_PROPID_getetag,
what, phdr);
-#ifdef DAV_PROPID_FS_executable
+
+#ifdef DAV_FS_HAS_EXECUTABLE
+ /* Only insert this property if it is defined for this platform. */
(void) dav_fs_insert_prop(resource, DAV_PROPID_FS_executable,
what, phdr);
#endif