Skip to content

Commit

Permalink
Make Worlds folder setting read-only
Browse files Browse the repository at this point in the history
  • Loading branch information
dolphinspired committed Mar 9, 2021
1 parent c7fa084 commit eafda3d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ValheimServerGUI.Controls/Controls/FilenameFormField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ public string Value
set => this.TextBox.Text = value;
}

public bool ReadOnly
{
get => this.TextBox.ReadOnly;
set
{
this.TextBox.ReadOnly = value;
this.FileBrowserButton.Enabled = !value;
}
}

/// <summary>
/// Sets the initial directory that the file/folder dialog will open to.
/// If null, will default to the directory of the current Value of this control.
Expand Down
4 changes: 4 additions & 0 deletions ValheimServerGUI/Forms/DirectoriesForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ private void InitializeFormFields()

this.GamePathField.ConfigureFileDialog(dialog => dialog.Filter = "Applications (*.exe)|*.exe");
this.ServerPathField.ConfigureFileDialog(dialog => dialog.Filter = "Applications (*.exe)|*.exe");

// Currently valheim_server doesn't support using different world folders.
// Re-enable this control and properly add support in the server options if a method ever gets added to do this.
this.WorldsFolderField.ReadOnly = true;
}

private void ButtonOK_Click(object sender, EventArgs e)
Expand Down

0 comments on commit eafda3d

Please sign in to comment.