diff options
Diffstat (limited to 'doc/classes/OS.xml')
-rw-r--r-- | doc/classes/OS.xml | 107 |
1 files changed, 31 insertions, 76 deletions
diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index 8c90108aef..a9396306f4 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -94,7 +94,7 @@ </argument> <argument index="1" name="arguments" type="PackedStringArray"> </argument> - <argument index="2" name="output" type="Array" default="[ ]"> + <argument index="2" name="output" type="Array" default="[]"> </argument> <argument index="3" name="read_stderr" type="bool" default="false"> </argument> @@ -136,6 +136,14 @@ Returns the keycode of the given string (e.g. "Escape"). </description> </method> + <method name="get_cache_dir" qualifiers="const"> + <return type="String"> + </return> + <description> + Returns the [i]global[/i] cache data directory according to the operating system's standards. On desktop platforms, this path can be overridden by setting the [code]XDG_CACHE_HOME[/code] environment variable before starting the project. See [url=https://docs.godotengine.org/en/latest/tutorials/io/data_paths.html]File paths in Godot projects[/url] in the documentation for more information. See also [method get_config_dir] and [method get_data_dir]. + Not to be confused with [method get_user_data_dir], which returns the [i]project-specific[/i] user data path. + </description> + </method> <method name="get_cmdline_args"> <return type="PackedStringArray"> </return> @@ -143,7 +151,7 @@ Returns the command-line arguments passed to the engine. Command-line arguments can be written in any form, including both [code]--key value[/code] and [code]--key=value[/code] forms so they can be properly parsed, as long as custom command-line arguments do not conflict with engine arguments. You can also incorporate environment variables using the [method get_environment] method. - You can set [code]editor/main_run_args[/code] in the Project Settings to define command-line arguments to be passed by the editor when running the project. + You can set [member ProjectSettings.editor/run/main_run_args] to define command-line arguments to be passed by the editor when running the project. Here's a minimal example on how to parse command-line arguments into a dictionary using the [code]--key=value[/code] form for arguments: [codeblocks] [gdscript] @@ -167,6 +175,14 @@ [/codeblocks] </description> </method> + <method name="get_config_dir" qualifiers="const"> + <return type="String"> + </return> + <description> + Returns the [i]global[/i] user configuration directory according to the operating system's standards. On desktop platforms, this path can be overridden by setting the [code]XDG_CONFIG_HOME[/code] environment variable before starting the project. See [url=https://docs.godotengine.org/en/latest/tutorials/io/data_paths.html]File paths in Godot projects[/url] in the documentation for more information. See also [method get_cache_dir] and [method get_data_dir]. + Not to be confused with [method get_user_data_dir], which returns the [i]project-specific[/i] user data path. + </description> + </method> <method name="get_connected_midi_inputs"> <return type="PackedStringArray"> </return> @@ -176,32 +192,12 @@ [b]Note:[/b] This method is implemented on Linux, macOS and Windows. </description> </method> - <method name="get_date" qualifiers="const"> - <return type="Dictionary"> - </return> - <argument index="0" name="utc" type="bool" default="false"> - </argument> - <description> - Returns current date as a dictionary of keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]weekday[/code], [code]dst[/code] (Daylight Savings Time). - </description> - </method> - <method name="get_datetime" qualifiers="const"> - <return type="Dictionary"> - </return> - <argument index="0" name="utc" type="bool" default="false"> - </argument> - <description> - Returns current datetime as a dictionary of keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]weekday[/code], [code]dst[/code] (Daylight Savings Time), [code]hour[/code], [code]minute[/code], [code]second[/code]. - </description> - </method> - <method name="get_datetime_from_unix_time" qualifiers="const"> - <return type="Dictionary"> + <method name="get_data_dir" qualifiers="const"> + <return type="String"> </return> - <argument index="0" name="unix_time_val" type="int"> - </argument> <description> - Gets a dictionary of time values corresponding to the given UNIX epoch time (in seconds). - The returned Dictionary's values will be the same as [method get_datetime], with the exception of Daylight Savings Time as it cannot be determined from the epoch. + Returns the [i]global[/i] user data directory according to the operating system's standards. On desktop platforms, this path can be overridden by setting the [code]XDG_DATA_HOME[/code] environment variable before starting the project. See [url=https://docs.godotengine.org/en/latest/tutorials/io/data_paths.html]File paths in Godot projects[/url] in the documentation for more information. See also [method get_cache_dir] and [method get_config_dir]. + Not to be confused with [method get_user_data_dir], which returns the [i]project-specific[/i] user data path. </description> </method> <method name="get_environment" qualifiers="const"> @@ -221,6 +217,13 @@ Returns the path to the current engine executable. </description> </method> + <method name="get_external_data_dir" qualifiers="const"> + <return type="String"> + </return> + <description> + On Android, returns the absolute directory path where user data can be written to external storage if available. On all other platforms, this will return the same location as [method get_user_data_dir]. + </description> + </method> <method name="get_granted_permissions" qualifiers="const"> <return type="PackedStringArray"> </return> @@ -313,64 +316,15 @@ [b]Note:[/b] Thread IDs are not deterministic and may be reused across application restarts. </description> </method> - <method name="get_ticks_msec" qualifiers="const"> - <return type="int"> - </return> - <description> - Returns the amount of time passed in milliseconds since the engine started. - </description> - </method> - <method name="get_ticks_usec" qualifiers="const"> - <return type="int"> - </return> - <description> - Returns the amount of time passed in microseconds since the engine started. - </description> - </method> - <method name="get_time" qualifiers="const"> - <return type="Dictionary"> - </return> - <argument index="0" name="utc" type="bool" default="false"> - </argument> - <description> - Returns current time as a dictionary of keys: hour, minute, second. - </description> - </method> - <method name="get_time_zone_info" qualifiers="const"> - <return type="Dictionary"> - </return> - <description> - Returns the current time zone as a dictionary with the keys: bias and name. - </description> - </method> <method name="get_unique_id" qualifiers="const"> <return type="String"> </return> <description> Returns a string that is unique to the device. + [b]Note:[/b] This string may change without notice if the user reinstalls/upgrades their operating system or changes their hardware. This means it should generally not be used to encrypt persistent data as the data saved prior to an unexpected ID change would become inaccessible. The returned string may also be falsified using external programs, so do not rely on the string returned by [method get_unique_id] for security purposes. [b]Note:[/b] Returns an empty string on HTML5 and UWP, as this method isn't implemented on those platforms yet. </description> </method> - <method name="get_unix_time" qualifiers="const"> - <return type="float"> - </return> - <description> - Returns the current UNIX epoch timestamp in seconds. - [b]Important:[/b] This is the system clock that the user can manully set. [b]Never use[/b] this method for precise time calculation since its results are also subject to automatic adjustments by the operating system. [b]Always use[/b] [method get_ticks_usec] or [method get_ticks_msec] for precise time calculation instead, since they are guaranteed to be monotonic (i.e. never decrease). - </description> - </method> - <method name="get_unix_time_from_datetime" qualifiers="const"> - <return type="int"> - </return> - <argument index="0" name="datetime" type="Dictionary"> - </argument> - <description> - Gets an epoch time value from a dictionary of time values. - [code]datetime[/code] must be populated with the following keys: [code]year[/code], [code]month[/code], [code]day[/code], [code]hour[/code], [code]minute[/code], [code]second[/code]. - If the dictionary is empty [code]0[/code] is returned. - You can pass the output from [method get_datetime_from_unix_time] directly into this function. Daylight Savings Time ([code]dst[/code]), if present, is ignored. - </description> - </method> <method name="get_user_data_dir" qualifiers="const"> <return type="String"> </return> @@ -380,6 +334,7 @@ On macOS, this is [code]~/Library/Application Support/Godot/app_userdata/[project_name][/code], or [code]~/Library/Application Support/[custom_name][/code] if [code]use_custom_user_dir[/code] is set. On Windows, this is [code]%APPDATA%\Godot\app_userdata\[project_name][/code], or [code]%APPDATA%\[custom_name][/code] if [code]use_custom_user_dir[/code] is set. [code]%APPDATA%[/code] expands to [code]%USERPROFILE%\AppData\Roaming[/code]. If the project name is empty, [code]user://[/code] falls back to [code]res://[/code]. + Not to be confused with [method get_data_dir], which returns the [i]global[/i] (non-project-specific) user data directory. </description> </method> <method name="has_environment" qualifiers="const"> |