Exemplo n.º 1
0
        /// <summary>
        ///  Move itself to a destination path (absolute or relative)
        /// </summary>
        private bool __move(string destPath)
        {
            if (SqlFsFunc.isNullOrEmpty(destPath))
            {
                SqlFsErrCode.CurrentError = FsErr.EmptyString;
                return(false);
            }

            // determine destination dir
            SqlDir destDir = null;

            if (destPath.StartsWith(SqlFsConst.STRPATHSEP))
            {
                // absolute path
                SqlDir rootDir = (SqlDir)SqlFs.getFsNodeByID(db, fsLocker, SqlFsConst.ROOTDIRID);           // get root
                destPath = SqlFsFunc.Trim(destPath, new char[] { SqlFsConst.PATHSEP });
                // if empty after trim, it refers to root
                destDir = SqlFsFunc.isNullOrEmpty(destPath) ? rootDir : rootDir.getDir(destPath);
            }
            else
            {
                // relative path
                SqlDir parent = this.Parent;
                if (parent != null)
                {
                    destDir = parent.getDir(destPath);
                }
            }

            if (destDir != null)
            {
                return(__move(destDir));
            }

            SqlFsErrCode.CurrentError = FsErr.DestDirNotFound;
            return(false);
        }
Exemplo n.º 2
0
 internal virtual SqlFsNode getFsNodeByID(FsID id)
 {
     return(SqlFs.getFsNodeByID(db, fsLocker, id));
 }