public int SetFileAttributes( String filename, FileAttributes attr, DokanFileInfo info) { Debug("SetFileAttributes {0}", filename); try { string path = GetPath(filename); ChannelSftp channel = GetChannel(); SftpATTRS sattr = channel.stat(path); int permissions = sattr.getPermissions(); Debug(" permissons {0} {1}", permissions, sattr.getPermissionsString()); sattr.setPERMISSIONS(permissions); channel.setStat(path, sattr); return(0); } catch (SftpException) { return(-1); } catch (Exception e) { connectionError_ = true; Debug(e.ToString()); Reconnect(); return(-1); } }
private bool WritePermission( string path, int permission) { try { Debug("WritePermission {0}:{1}", path, Convert.ToString(permission, 8)); ChannelSftp channel = GetChannel(); SftpATTRS attr = channel.stat(path); attr.setPERMISSIONS(permission); channel.setStat(path, attr); } catch (SftpException) { } catch (Exception e) { connectionError_ = true; Debug(e.ToString()); Reconnect(); } return(true); }