Skip to content

Bug fix re profile loading if no registry keys found#1056

Closed
lansalot wants to merge 4 commits intoAgOpenGPS-Official:developfrom
lansalot:fix/NoRegPromptOpenProfile
Closed

Bug fix re profile loading if no registry keys found#1056
lansalot wants to merge 4 commits intoAgOpenGPS-Official:developfrom
lansalot:fix/NoRegPromptOpenProfile

Conversation

@lansalot
Copy link
Copy Markdown
Contributor

Fixes #1055

if (RegistrySettings.vehicleFileName == "")
{
Log.EventWriter("No profile selected, prompt to create a new one");
if (!Directory.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "agOpenGPS")))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably use RegistrySettings.baseDirectory here (or RegistrySettings.vehiclesDirectory)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I didn't mean line 530, I meant line 532. You shouldn't have to explicitly check for an "agOpenGPS" folder in "Documents", because that could be different.

richardklasens
richardklasens previously approved these changes Nov 26, 2025
@FantasyTeddy
Copy link
Copy Markdown
Contributor

@richardklasens: I did not yet approve this PR, because there is still an open comment.

@farmerbriantee
Copy link
Copy Markdown
Contributor

Seems there are a couple scenarios. One is there are no profiles to choose from, and second there are some however the registry says default.

There also happens to be 2 forms, one for loading a profile, and one for making a new profile

Every time the program is run, the first thing that occurs is if there are no registry keys, they are created again - so we know at the very least they are there. If not, the program stops anyway.

So just as a suggestion, you can grab the vehicles directory from settings - no matter what is there - and then check if there are existing profiles there or if empty.

If empty - up poops the new form
If at least 1 profile - up poops the load form.

Depending on the form about to arrive to them, throw up a message box.

That might work, and you also won't be hardcoding directory names that may change or have been previously set to another directory.

@farmerbriantee farmerbriantee self-requested a review November 28, 2025 15:42
@FantasyTeddy FantasyTeddy dismissed richardklasens’s stale review November 28, 2025 15:44

There is still an open comment that should be resolved.

@farmerbriantee farmerbriantee removed their request for review November 28, 2025 15:46
@lansalot lansalot deleted the fix/NoRegPromptOpenProfile branch April 20, 2026 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prompted to create a new profile if reg keys missing, even if there are existing ones that could be used

4 participants