Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
 private string ReadPermission(string path)
 {
     try
     {
         SftpATTRS attr = GetChannel().stat(path);
         return(Convert.ToString(attr.getPermissions() & 0xFFF, 8) + "\n");
     }
     catch (SftpException)
     {
         return("");
     }
     catch (Exception)
     {
         connectionError_ = true;
         Reconnect();
         return("");
     }
 }