Ejemplo n.º 1
0
        private void RawCreateDirectory(string path)
        {
            int index = path.LastIndexOf("/", StringComparison.OrdinalIgnoreCase);

            if (index == -1)
            {
                path  = "/" + path;
                index = 0;
            }
            string baseDir       = path.Substring(0, index);
            string dirName       = path.Substring(index + 1);
            bool   pushedBaseDir = false;

            if (baseDir.Trim() != String.Empty) //fix bug 4886
            {
                pushedBaseDir = pushDirectory(baseDir);
                if (!pushedBaseDir)
                {
                    RawCreateDirectory(baseDir);
                    ValidateFTPCommand(pushDirectory(baseDir)); ////fix bug 4886 - avoid stackoverflow if directory was not properly pushed.
                    pushedBaseDir = true;
                }
            }

            ValidateFTPCommand(WinInet.FtpCreateDirectory(m_hFtp, dirName));

            if (pushedBaseDir)
            {
                popDirectory();
            }
        }