Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FileSelect Widget #47

Merged
merged 5 commits into from
Mar 14, 2024
Merged

Add FileSelect Widget #47

merged 5 commits into from
Mar 14, 2024

Conversation

AlexKnauth
Copy link
Contributor

@AlexKnauth AlexKnauth commented Jan 11, 2024

A companion PR to LiveSplit/livesplit-core#748, depends on #46.

Implements the FileSelect widget as a path in the OBS properties. The user can select a file, and the WASI-compatible path to that file gets stored in the settings map.

  • Test it with an autosplitter that wouldn't split if it doesn't get the path properly, but does split if it works.

@AlexKnauth AlexKnauth marked this pull request as ready for review January 11, 2024 19:45
Cargo.toml Outdated Show resolved Hide resolved
src/lib.rs Outdated
Comment on lines 923 to 925
Some(_) => {
warn!("Unknown / unimplemented value type");
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should probably be the same case as None (and even then it seems like both remaining cases should probably be deduplicated. You always have to consider that the settings map may contain a bunch of garbage. The widgets always have higher precedence than what garbage is in the settings map. So you would default to an empty string (or in this case, no path at all).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed in the Remove Some(_) case, merge with None case commit.

src/lib.rs Outdated
Comment on lines 1021 to 1023
let value = obs_data_get_string(settings, SETTINGS_AUTO_SPLITTER_SETTINGS_FILE_SELECT);

obs_data_set_string(settings, SETTINGS_AUTO_SPLITTER_SETTINGS_FILE_SELECT, value);
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does this do? It looks like it sets back the value that we just read?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't really know. I just saw a similar line in the boolean / checkbox case and copied it. I can delete it and re-test stuff.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have a branch that changes that here: https://github.com/AlexKnauth/obs-livesplit-one/tree/file-select-test

At some point in the next day or so I'll find time to test it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the Remove redundant set=get I removed this line in both the file-select case and the bool case. I tested it with a contrived auto-splitter that put the "wrong" type in, and it seemed to work just fine, as long as this change goes together with the Remove Some(_) case, merge with None case commit.

@AlexKnauth AlexKnauth requested a review from CryZe January 27, 2024 01:01
@CryZe CryZe merged commit d92dd75 into LiveSplit:master Mar 14, 2024
15 checks passed
@AlexKnauth AlexKnauth deleted the file-select branch March 14, 2024 21:54
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.

2 participants