private void EnsureParentDirExist(string path) { string parent_dir = GetUnixDirectoryName(path); if (null == GetAttributes(parent_dir)) { _sftpSession.RequestMkDir(parent_dir); } }
DokanError IDokanOperations.CreateDirectory(string fileName, DokanFileInfo info) { Log("CreateDir:{0}", fileName); try { _sftpSession.RequestMkDir(GetUnixPath(fileName)); InvalidateParentCache(fileName); //invalidate dircahe of the parent } catch (SftpPermissionDeniedException) { return(DokanError.ErrorAccessDenied); } catch (SshException) // operation should fail with generic error if file already exists { return(DokanError.ErrorAlreadyExists); } return(DokanError.ErrorSuccess); }