Skip to content

Commit

Permalink
Fix incorrect string escaping in OS.shell_open() method Windows path …
Browse files Browse the repository at this point in the history
…example

Corrected improper string escaping in the OS.shell_open() Windows path example. Backslashes are now properly escaped to prevent string parsing errors. Also, added a new alternative example of how to mount a Windows path with OS.shell_open().
  • Loading branch information
mateuseap committed Jan 8, 2025
1 parent aa65940 commit 8a810dd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doc/classes/OS.xml
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,8 @@
<param index="0" name="uri" type="String" />
<description>
Requests the OS to open a resource identified by [param uri] with the most appropriate program. For example:
- [code]OS.shell_open("C:\\Users\name\Downloads")[/code] on Windows opens the file explorer at the user's Downloads folder.
- [code]OS.shell_open("C:\\Users\\name\\Downloads")[/code] on Windows opens the file explorer at the user's Downloads folder.
- [code]OS.shell_open("C:/Users/name/Downloads")[/code] also works on Windows and opens the file explorer at the user's Downloads folder.
- [code]OS.shell_open("https://godotengine.org")[/code] opens the default web browser on the official Godot website.
- [code]OS.shell_open("mailto:example@example.com")[/code] opens the default email client with the "To" field set to [code]example@example.com[/code]. See [url=https://datatracker.ietf.org/doc/html/rfc2368]RFC 2368 - The [code]mailto[/code] URL scheme[/url] for a list of fields that can be added.
Use [method ProjectSettings.globalize_path] to convert a [code]res://[/code] or [code]user://[/code] project path into a system path for use with this method.
Expand Down

0 comments on commit 8a810dd

Please sign in to comment.