vfs icon indicating copy to clipboard operation
vfs copied to clipboard

Support for opening OS files that are not writable

Open aucampia opened this issue 3 years ago • 4 comments

Currently OS files are always opened in read/write mode. In cases where files are not writable to the process this causes problems. It would be good to have some way to accomodate read only OS files.

aucampia avatar Jun 23 '21 09:06 aucampia

One way this could be implemented is to add an Options varargs type to Open, and then make a read only option. Other suggestions would be appreciated.

aucampia avatar Jun 23 '21 10:06 aucampia

This may be relevant to SFTP also

aucampia avatar Jun 23 '21 10:06 aucampia

@aucampia - my first thought was to include this as an option as well. It might just need a bit of thought on how error handling works for some of the vfs.File interface methods when the option is enabled.

Perhaps an alternative is to make the getInternalFile() function take the file mode, and then let the consumers of that getInternalFile function (vfs.Read(), vfs.Write(), etc...) pass the required modes to perform that operation. A hybrid approach might work as well.

seeroush avatar Jun 23 '21 13:06 seeroush