@@ -16,10 +16,23 @@ #import "OFObject.h" #import "OFSeekableStream.h" OF_ASSUME_NONNULL_BEGIN + +#if defined(OF_HAVE_CHMOD) && !defined(OF_MORPHOS) +# define OF_FILE_MANAGER_SUPPORTS_PERMISSIONS +#endif +#if defined(OF_HAVE_CHOWN) && !defined(OF_MORPHOS) +# define OF_FILE_MANAGER_SUPPORTS_OWNER +#endif +#if (defined(OF_HAVE_LINK) && !defined(OF_MORPHOS)) || defined(OF_WINDOWS) +# define OF_FILE_MANAGER_SUPPORTS_LINKS +#endif +#if (defined(OF_HAVE_SYMLINK) && !defined(OF_MORPHOS)) || defined(OF_WINDOWS) +# define OF_FILE_MANAGER_SUPPORTS_SYMLINKS +#endif @class OFArray OF_GENERIC(ObjectType); @class OFDate; /*! @@ -55,11 +68,11 @@ * @param path The path to check * @return A boolean whether there is a directory at the specified path */ - (bool)directoryExistsAtPath: (OFString *)path; -#if defined(OF_HAVE_SYMLINK) || defined(OF_WINDOWS) +#ifdef OF_FILE_MANAGER_SUPPORTS_SYMLINKS /*! * @brief Checks whether a symbolic link exists at the specified path. * * @param path The path to check * @return A boolean whether there is a symbolic link at the specified path @@ -136,11 +149,11 @@ * * @return The last status change time of the specified item */ - (OFDate *)statusChangeTimeOfItemAtPath: (OFString *)path; -#ifdef OF_HAVE_CHMOD +#ifdef OF_FILE_MANAGER_SUPPORTS_PERMISSIONS /*! * @brief Returns the permissions of the specified item. * * This returns only the permissions, meaning read, write and execute for * owner, user and group, along with the sticky, setuid and setgid bit. In @@ -166,11 +179,11 @@ */ - (void)changePermissionsOfItemAtPath: (OFString *)path permissions: (uint16_t)permissions; #endif -#ifdef OF_HAVE_CHOWN +#ifdef OF_FILE_MANAGER_SUPPORTS_OWNER /*! * @brief Get the owner and group of the specified item. * * @param owner A pointer to an `OFString *` to store the owner, or nil * @param group A pointer to an `OFString *` to store the group, or nil @@ -233,11 +246,11 @@ * * @param path The path to the item which should be removed */ - (void)removeItemAtPath: (OFString *)path; -#if defined(OF_HAVE_LINK) || defined(OF_WINDOWS) +#ifdef OF_FILE_MANAGER_SUPPORTS_LINKS /*! * @brief Creates a hard link for the specified item. * * The destination path must be a full path, which means it must include the * name of the item. @@ -249,11 +262,11 @@ */ - (void)linkItemAtPath: (OFString *)source toPath: (OFString *)destination; #endif -#if defined(OF_HAVE_SYMLINK) || defined(OF_WINDOWS) +#ifdef OF_FILE_MANAGER_SUPPORTS_SYMLINKS /*! * @brief Creates a symbolic link for an item. * * The destination path must be a full path, which means it must include the * name of the item. @@ -268,13 +281,11 @@ * @param source The path to the item for which a symbolic link should be * created */ - (void)createSymbolicLinkAtPath: (OFString *)destination withDestinationPath: (OFString *)source; -#endif -#if defined(OF_HAVE_READLINK) || defined(OF_WINDOWS) /*! * @brief Returns the destination of the symbolic link at the specified path. * * @param path The path to the symbolic link *