Skip to content

Commit

Permalink
a fix for one path we didn't get for jimmejardine#106 + be more stric…
Browse files Browse the repository at this point in the history
…t in checking whether a Web Library sync directory has been properly set up.
  • Loading branch information
GerHobbelt committed Oct 19, 2019
1 parent e6ee95f commit 761b192
Showing 1 changed file with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ public partial class IntranetLibraryChooserControl : StandardWindow
public IntranetLibraryChooserControl()
{
InitializeComponent();

this.Title =
this.Header.Caption =
"Create/Join Intranet Library";

this.Title =
this.Header.Caption = "Create/Join Intranet Library";

this.Header.SubCaption = "Please confirm the details of the Intranet Library you wish to create or join.";
this.Header.Img = Icons.GetAppIcon(Icons.WebLibrary_IntranetLibrary);
Expand Down Expand Up @@ -83,7 +82,7 @@ private void ValidateFolder()
string base_path = TxtPath.Text;
if (Directory.Exists(base_path))
{
string library_detail_path = IntranetLibraryTools.GetLibraryDetailPath(base_path);
string library_detail_path = IntranetLibraryTools.GetLibraryDetailPath(base_path);
if (File.Exists(library_detail_path))
{
IntranetLibraryDetail library_detail = IntranetLibraryDetail.Read(library_detail_path);
Expand Down Expand Up @@ -125,10 +124,9 @@ private bool EnsureIntranetLibraryExists()
IntranetLibraryDetail.Write(library_detail_path, library_detail);
}
}

catch (Exception ex)
{
Logging.Error(ex, "There was an error while updating an Intranet Library path, so will try to delete and recreate...");
Logging.Error(ex, "There was an error while updating an Intranet Library path, so will try to delete and recreate... (path: {0})", base_path);
FileTools.Delete(library_detail_path);
}
}
Expand Down Expand Up @@ -163,7 +161,7 @@ private bool EnsureIntranetLibraryExists()
private void EnsureWarningFilesArePresent(string base_path)
{
IEnumerable<string> warning_files = Directory.EnumerateFiles(base_path, "---*");
if (0 == warning_files.Count())
if (7 != warning_files.Count())
{
EnsureWarningFilesArePresent_TOUCH(base_path, "---0--- --------------------------------------------------------------------------");
EnsureWarningFilesArePresent_TOUCH(base_path, "---1--- THIS IS A QIQQA INTRANET LIBRARY SYNC FOLDER");
Expand All @@ -177,25 +175,29 @@ private void EnsureWarningFilesArePresent(string base_path)

private void EnsureWarningFilesArePresent_TOUCH(string base_path, string filename)
{
string path = Path.GetFullPath(Path.Combine(base_path, filename));

try
{
File.WriteAllText(base_path + '/' + filename, "");
if (!File.Exists(path))
{
File.WriteAllText(path, "");
}
}
catch (Exception ex)
{
Logging.Warn(ex, "Problem writing Intranet Library mount point warnings");
Logging.Warn(ex, "Problem writing Intranet Library mount point warnings (path: {0})", path);
}
}


void ObjButtonFolderChoose_Click(object sender, RoutedEventArgs e)
{
using (FolderBrowserDialog dlg = new FolderBrowserDialog
{
Description = "Please select the shared directory for your Intranet Library.",
SelectedPath = TxtPath.Text,
ShowNewFolderButton = true
})
{
Description = "Please select the shared directory for your Intranet Library.",
SelectedPath = TxtPath.Text,
ShowNewFolderButton = true
})
{
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
Expand Down

0 comments on commit 761b192

Please sign in to comment.