Check for presence of directory

svn path=/trunk/; revision=19527
This commit is contained in:
Casper Hornstrup 2005-11-24 13:57:25 +00:00
parent 51c3c77902
commit e0c1c5a1df
2 changed files with 16 additions and 2 deletions

View file

@ -354,7 +354,21 @@ namespace ReactOS.CustomRevisionAction
return msg;
}
public bool DirectoryExists(string directory)
{
try
{
ChangeDir(directory);
ChangeDir("..");
return true;
}
catch (FtpException)
{
return false;
}
}
/// <summary>
/// Return the size of a file.
/// </summary>

View file

@ -193,7 +193,7 @@ namespace ReactOS.CustomRevisionAction
if (directory != "")
ftpClient.ChangeDir(directory);
/* Create destination directory if it does not already exist */
if (ftpClient.GetFileList(branch).Length < 1)
if (!ftpClient.DirectoryExists(branch))
ftpClient.MakeDir(branch);
ftpClient.ChangeDir(branch);
ftpClient.Upload(sourceFilename);