Beispiel #1
0
        public int SetAllocationSize(string filename, long length, DokanFileInfo info)
        {
            int ret = DokanNet.DOKAN_SUCCESS;

            filename = CleanFileName(filename);

            try
            {
                Debug("SetEndOfFile {0}", filename);
                string Directory = nfsClient.GetDirectoryName(filename);
                string FileName  = nfsClient.GetFileName(filename);
                string FullName  = nfsClient.Combine(FileName, Directory);

                NFSLibrary.Protocols.Commons.NFSAttributes attr = nfsClient.GetItemAttributes(FullName);
                if (attr.Size < length)
                {
                    nfsClient.SetFileSize(FullName, length);
                }
            }
            catch (Exception ex)
            {
                ret = DokanNet.DOKAN_ERROR;
                Debug("SetEndOfFile file {0} newfile {1} exception {2}", filename, ex.Message);
            }

            return(ret);
        }