Skip to content

docs: document that shell.trashItem requires backslashes - #49038

Merged
jkleinsc merged 1 commit into
electron:mainfrom
sammarshallou:patch-1
Jan 21, 2026
Merged

jkleinsc merged 1 commit into
electron:mainfrom
sammarshallou:patch-1

Conversation

@sammarshallou

@sammarshallou sammarshallou commented Nov 21, 2025 •

Copy link
Copy Markdown
Contributor

In Windows many functions relating to files (e.g. shell.openItem, the Node fs functions, as well as native Win32 APIs) will accept either type of slash / or \ as a folder separator.

shell.trashItem does not work with / as folder separator in Windows. This documentation change explains that.

See also:
#28831

Description of Change

Checklist

Release Notes

Notes: none

@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Nov 21, 2025

@ckerr ckerr left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

TBH I'm not sure if this should be treated as something that needs to be documented, or as a bug that needs to be fixed.

Flagging for API review

@nikwen

nikwen commented Nov 24, 2025

Copy link
Copy Markdown
Member

I'd suggest fixing the underlying bug instead of documenting the behavior.

@codebytere

codebytere commented Nov 25, 2025 •

Copy link
Copy Markdown
Member

@ckerr @nikwen this is and has been expected behavior - Electron APIs that take in file paths required resolved paths with the correct path separators. This is true for every API that takes a base::FilePath.

Comment thread docs/api/shell.md Resolved
@electron-cation electron-cation Bot added new-pr 🌱 PR opened recently and removed new-pr 🌱 PR opened recently labels Nov 25, 2025
@sammarshallou

Copy link
Copy Markdown
Contributor Author

I updated it to say that path.resolve() should be used, maybe my new text is better? (By the way I just filed this because I hit the behaviour on this particular function and it took me a while to figure out why it wasn't working. Then when I finally did and searched for it, I noticed from the earlier bug report that somebody else had hit the exact same problem before, so I thought it might be worth documenting.)

@nikwen nikwen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

Could you please sign your commits? (See the bot comment above.) Otherwise, we can't merge them.

@nikwen nikwen changed the title Update shell.md: Document that shell.trashItem requires backslashes docs: document that shell.trashItem requires backslashes Nov 28, 2025
@sammarshallou

Copy link
Copy Markdown
Contributor Author

@nikwen Apologies for missing that. I have amended the commit to add signature (no other changes), it is showing verified so hopefully that's OK.

@nikwen nikwen added target/39-x-y PR should also be added to the "39-x-y" branch. target/40-x-y PR should also be added to the "40-x-y" branch. and removed no-backport semver/patch backwards-compatible bug fixes labels Jan 5, 2026
@github-actions github-actions Bot added the target/41-x-y PR should also be added to the "41-x-y" branch. label Jan 19, 2026
@codebytere

Copy link
Copy Markdown
Member

@sammarshallou can you rebase this?

…shes

In Windows many functions relating to files (e.g. shell.openItem, the Node fs functions, as well as native Win32 APIs) will accept either type of slash / or \ as a folder separator.

shell.trashItem does not work with / as folder separator in Windows. This documentation change explains that.

See also:
electron#28831
@sammarshallou

Copy link
Copy Markdown
Contributor Author

@codebytere I have rebased against 'main' branch, hopefully that is ok (there were no conflicts).

@jkleinsc
jkleinsc merged commit d141934 into electron:main Jan 21, 2026
@welcome

welcome Bot commented Jan 21, 2026

Copy link
Copy Markdown

Congrats on merging your first pull request! 🎉🎉🎉

@release-clerk

release-clerk Bot commented Jan 21, 2026

Copy link
Copy Markdown

No Release Notes

@trop

trop Bot commented Jan 21, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "39-x-y", please check out #49479

@trop trop Bot added in-flight/39-x-y and removed target/39-x-y PR should also be added to the "39-x-y" branch. labels Jan 21, 2026
@trop

trop Bot commented Jan 21, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "40-x-y", please check out #49480

@trop

trop Bot commented Jan 21, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "41-x-y", please check out #49481

@trop trop Bot added in-flight/40-x-y in-flight/41-x-y merged/41-x-y PR was merged to the "41-x-y" branch. merged/40-x-y PR was merged to the "40-x-y" branch. merged/39-x-y PR was merged to the "39-x-y" branch. and removed target/40-x-y PR should also be added to the "40-x-y" branch. target/41-x-y PR should also be added to the "41-x-y" branch. in-flight/41-x-y in-flight/40-x-y in-flight/39-x-y labels Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation 📓 merged/39-x-y PR was merged to the "39-x-y" branch. merged/40-x-y PR was merged to the "40-x-y" branch. merged/41-x-y PR was merged to the "41-x-y" branch. semver/none

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants