Skip to content

Comments

Use only basename when forming stem from script and tag#53

Merged
kylebaron merged 1 commit intomainfrom
fix/tag-behavior
Mar 6, 2025
Merged

Use only basename when forming stem from script and tag#53
kylebaron merged 1 commit intomainfrom
fix/tag-behavior

Conversation

@kylebaron
Copy link
Contributor

@kylebaron kylebaron commented Mar 6, 2025

See example in #52

There's a feature where you can set a context and save a series of plots using a combination of the context name and a "tag" that is supplied with each plot.

> mrggsave:::make_stem("foo.R", tag = "plot1")
[1] "foo-plot1"

The default "context" is the name of the script, but you can override that through an option.

This was causing a problem when we started passing in the full path to the script:

> mrggsave:::make_stem("script/foo.R", tag = "plot1")
[1] "script/foo-plot1"

This PR just takes the basename() of script prior to starting this whole process off to ensure we don't get a path to output file that we didn't intend.

The change here is only meant to preserve existing behavior, which was expecting script to be just the name of the script.

@kylebaron kylebaron requested a review from kyleam March 6, 2025 15:32
@kylebaron
Copy link
Contributor Author

@KatherineKayMRG heads up.

@kylebaron kylebaron merged commit 65429f4 into main Mar 6, 2025
7 checks passed
@kylebaron kylebaron deleted the fix/tag-behavior branch March 6, 2025 21:03
@kylebaron kylebaron mentioned this pull request Mar 21, 2025
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