diff --git a/src/managed/OpenLiveWriter.Localization/MessageId.cs b/src/managed/OpenLiveWriter.Localization/MessageId.cs index 6e47c6e1..3c5472e1 100644 --- a/src/managed/OpenLiveWriter.Localization/MessageId.cs +++ b/src/managed/OpenLiveWriter.Localization/MessageId.cs @@ -31,6 +31,7 @@ namespace OpenLiveWriter.Localization FileInUse, FileNotFound, FinishedSearchingDocument, + FolderNotFound, FtpServerUnavailable, FtpSettingsRequired, GoogleAuthTokenNotFound, @@ -100,6 +101,7 @@ namespace OpenLiveWriter.Localization SpacesPublishingNotEnabled, SpellCheckCancelledStillPost, SpellCheckComplete, + SSGPublishCommandRequired, TagConfirmDeleteProvider, TagConfirmRestoreProviders, TagFormatRequired, diff --git a/src/managed/OpenLiveWriter.PostEditor/Configuration/Wizard/WeblogConfigurationWizardController.cs b/src/managed/OpenLiveWriter.PostEditor/Configuration/Wizard/WeblogConfigurationWizardController.cs index 8e7d37e4..6bff26ac 100644 --- a/src/managed/OpenLiveWriter.PostEditor/Configuration/Wizard/WeblogConfigurationWizardController.cs +++ b/src/managed/OpenLiveWriter.PostEditor/Configuration/Wizard/WeblogConfigurationWizardController.cs @@ -487,19 +487,7 @@ namespace OpenLiveWriter.PostEditor.Configuration.Wizard private void OnStaticSiteConfigCompleted(Object stepControl) { - if (_authenticationRequired) - AddSharePointAuthenticationStep((IAccountBasicInfoProvider)stepControl); - else - OnBasicInfoAndAuthenticationCompleted((IAccountBasicInfoProvider)stepControl, new PerformBlogAutoDetection(PerformSharePointAutoDetectionSubStep)); - } - - private void OnStaticSiteConfigUndone(Object stepControl) - { - if (_authenticationRequired && !_authenticationStepAdded) - { - AddSharePointAuthenticationStep((IAccountBasicInfoProvider)stepControl); - next(); - } + } #endregion diff --git a/src/managed/OpenLiveWriter.PostEditor/Configuration/Wizard/WeblogConfigurationWizardPanelStaticSiteConfig.cs b/src/managed/OpenLiveWriter.PostEditor/Configuration/Wizard/WeblogConfigurationWizardPanelStaticSiteConfig.cs index c9bbfad3..01af7c5e 100644 --- a/src/managed/OpenLiveWriter.PostEditor/Configuration/Wizard/WeblogConfigurationWizardPanelStaticSiteConfig.cs +++ b/src/managed/OpenLiveWriter.PostEditor/Configuration/Wizard/WeblogConfigurationWizardPanelStaticSiteConfig.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for details. using System; +using System.IO; using System.ComponentModel; using System.Diagnostics; using System.Drawing; @@ -112,19 +113,19 @@ namespace OpenLiveWriter.PostEditor.Configuration.Wizard public string LocalSitePath { - get => textBoxLocalSitePath.Text; + get => PathHelper.RemoveLeadingAndTrailingSlash(textBoxLocalSitePath.Text); set { textBoxLocalSitePath.Text = value; } } public string PostsPath { - get => textBoxPostsPath.Text; + get => PathHelper.RemoveLeadingAndTrailingSlash(textBoxPostsPath.Text); set { textBoxPostsPath.Text = value; } } public string PagesPath { - get => textBoxPagesPath.Text; + get => PathHelper.RemoveLeadingAndTrailingSlash(textBoxPagesPath.Text); set { textBoxPagesPath.Text = value; } } @@ -181,7 +182,36 @@ namespace OpenLiveWriter.PostEditor.Configuration.Wizard public override bool ValidatePanel() { - // TODO Check all paths and commands exist + if (!Directory.Exists(LocalSitePath)) + { + ShowValidationError(textBoxLocalSitePath, MessageId.FolderNotFound, LocalSitePath); + return false; + } + + var postsPathFull = $"{LocalSitePath}\\{PostsPath}"; + var pagesPathFull = $"{LocalSitePath}\\{PagesPath}"; + + // If the Posts path is empty or doesn't exist, display an error + if (PagesPath.Trim().Length == 0 || !Directory.Exists(postsPathFull)) + { + ShowValidationError(textBoxPostsPath, MessageId.FolderNotFound, postsPathFull); + return false; + } + + // If the Pages path is over 0 (pages enabled) and the path doesn't exist, display an error + if (PagesPath.Trim().Length > 0 && !Directory.Exists(pagesPathFull)) + { + ShowValidationError(textBoxPagesPath, MessageId.FolderNotFound, pagesPathFull); + return false; + } + + // Publish commands are required + if(PublishCmd.Trim().Length == 0) + { + ShowValidationError(textBoxPublishCmd, MessageId.SSGPublishCommandRequired); + return false; + } + return true; }