Example #1
0
        public override bool move(cape.File dest, bool replace)
        {
            onError(null);
            if (!(dest != null))
            {
                onError("null destination");
                return(false);
            }
            if (dest.exists())
            {
                if (!replace)
                {
                    onError("target file already exists");
                    return(false);
                }
                if (dest.remove() == false)
                {
                    onError("Error when removing `" + dest.getPath() + "': " + dest.getLastErrorDescription());
                    return(false);
                }
            }
            var destf = dest as cape.FileForDotNet;

            if (!(destf != null))
            {
                return(false);
            }
            var v = true;

            try {
                System.IO.File.Move(completePath, destf.completePath);
            }
            catch (System.Exception e) {
                onError(e.ToString());
                v = false;
            }
            return(v);
        }