Commit Graph

595 Commits

Author SHA1 Message Date
156bc92282 Merge pull request #98397 from adamscott/add-tmp-support
Add temp utilities (alias `OS::get_temp_dir()`, `FileAccess::create_temp()`, and `DirAccess::create_temp()`)
2024-12-03 14:40:59 -06:00
1b3e483899 Add file and dir temporary utilities
Co-authored by @Alex2782 for the Android bindings.
Many thanks to the reviewers also.

Co-authored-by: Alex <alex.hart.278@gmail.com>
2024-12-02 12:08:14 -05:00
d97313cd7d [FileAccess] Set last_error on file read/write errors. 2024-12-02 15:05:50 +02:00
a4b17e7852 [FileAccess] Return error codes from store_* methods. 2024-11-29 23:22:31 +02:00
c831f635fe [Web] Implement dummy IPWeb instead of IPUnix
Note: This commit ties the IPUnix to the UNIX_SOCKET_UNAVAILABLE define,
disabling it when set. It is maybe not semantically correct (getifaddrs)
is not part of the "socket" API, but it's reasonable to expect that a
platform not supporting Unix-style sockets, would also not support other
Unix network functions.
2024-11-28 20:47:18 +01:00
e9b57fce82 Convert line breaks to \n and strip line break from the end of string returned by OS::read_string_from_stdin/OS::get_stdin_string. 2024-11-23 15:11:50 +02:00
030cc69771 Merge pull request #96399 from andyprice/fileperms
Unix: Don't create world-writable files when safe save is enabled
2024-11-21 17:56:53 -06:00
1dcb686325 Merge pull request #99026 from Faless/net/split_ip
[Net] Split Unix/Windows IP implementation
2024-11-18 09:23:43 -06:00
68f638cf02 Use (r)find_char instead of (r)find for single characters 2024-11-17 10:02:18 +01:00
fc52821cfb [Net] Properly rename NetSocketPosix to NetSocketUnix 2024-11-13 10:27:01 +01:00
179321a0a3 Merge pull request #91201 from bruvzg/con_type
[OS] Add functions to determine standard I/O device type.
2024-11-12 12:13:12 -06:00
168a2a1466 [Net] Split Unix/Windows IP implementation 2024-11-12 17:33:47 +01:00
1cbe9715ea Merge pull request #98969 from Faless/net/split_sockets
[Net] Split Unix/Windows NetSocket implementation
2024-11-12 09:27:40 -06:00
0c620b29cd [Net] Split Unix/Windows NetSocket implementation 2024-11-10 16:13:50 +01:00
c09731c413 Warn on filesystem case mismatch
When a file is opened with a wrong case, it can work on the developer system but break on a user system with a case-sensitive filesystem.

This will display a warning when it happens.

CAVEATS: It will also display the warning if a symlink is in the path.

Adapt warning if the file is a symlink. Avoid warning on symlinks.

Fix memory leak and avoid `lstat` usage.

Avoid exposing real_path when not in TOOLS_ENABLED mode.
2024-11-08 14:23:41 -08:00
76164c2aa9 [OS] Add functions to determine standard I/O device type. 2024-11-06 13:33:38 +02:00
4cc9d2f437 [Linux/BSD] Fix cross-device rename. 2024-10-02 08:57:37 +03:00
ef7547384c Merge pull request #95678 from Hilderin/fix-slow-load-on-large-project-v2
Fix slow editor load on large projects (v2)
2024-09-26 12:45:31 +02:00
21f7c8a25f Fix slow editor load on large projects (v2) 2024-09-25 17:36:39 -04:00
9f9ee0c813 SCons: Add unobtrusive type hints in SCons files 2024-09-25 09:34:35 -05:00
84e24017b0 Adding a macro on NetSocketPosix to pick the right type for FIONREAD len
On Windows, `ioctlsocket` returns `len` as an unsigned long.
On Posix, `ioctl` returns `len` as an int.
This aims to fix #41287 bug, which was seen on Linux.
The implementation is just a new macro that is set with the proper type
for each platform.
2024-09-17 16:09:33 +02:00
cc52112144 Merge pull request #96643 from bruvzg/fs_links
[FileSystem Dock] Add symlink indicator and tooltip.
2024-09-12 10:28:44 +02:00
a87ceed163 Merge pull request #96639 from bruvzg/symlink_ren
Fix renaming directory symlinks on Linux.
2024-09-06 22:38:58 +02:00
64077ff3de unix: Limit named pipe permissions to the current user
Named pipes created using the "pipe://" file access scheme should not be
world-writable or readable. Limit their access to the current user by
creating them with 0600 permissions instead of 0666.
2024-09-06 19:40:31 +01:00
f49c9d7cd1 unix: Don't create world-writable files when safe save is enabled
When the "filesystem/on_save/safe_save_on_backup_then_rename" option is
enabled files are created with 0666 permissions (-rw-rw-rw-) which is
too loose. Use 0644 (-rw-r--r--) instead which is how the files would
normally be created with the setting disabled and the system umask taken
into account.
2024-09-06 17:36:21 +01:00
da4f5fb953 [FileSystem Dock] Add symlink indicator and tooltip. 2024-09-06 14:55:07 +03:00
10f3c1f587 Add support for non-blocking IO mode to OS.execute_with_pipe. 2024-09-06 14:16:39 +03:00
3e936e795c Fix renaming directory symlinks on Linux. 2024-09-06 13:22:20 +03:00
205a10e0ae Reduce code duplication in FileAccess 2024-09-01 12:39:32 +02:00
f44d6a235f Fix reload of GDExtension libraries in framework package on macos
`GDExtension::open_library` has a check in it to see if the library was loaded
from a temp file, and if it was to restore the original name as that is the one
we actually care about. This check is breaking extension reloading on Mac when
the library path is to a framework folder, as the file inside the framework
will not generally be the same name as the folder.

This check also shouldn't be necessary even on Windows, which is the only
platform that uses `generate_temp_files`, since disposal of the created temp
file is handled within `OS_Windows::open_dynamic_library`, and
`GDExtension::open_library` (which is the only function to call
`open_dynamic_library` with a `p_data` argument) only cares about the original
library file path and has to do extra work to remove the name of the temp file.
Instead, I have removed that check and set `OS_Windows::open_dynamic_library`
to return the name of the original file and not the name of the copy.

This fixes GDExtension reloading on macOS. I do not have a Windows machine
available to test that it still works properly on Windows, so someone should
check that before merging this.
2024-08-08 08:31:49 -06:00
955d5affa8 Reduce and prevent unnecessary random-access to List
Random-access access to `List` when iterating is `O(n^2)` (`O(n)` when
accessing a single element)

* Removed subscript operator, in favor of a more explicit `get`
* Added conversion from `Iterator` to `ConstIterator`
* Remade existing operations into other solutions when applicable
2024-05-04 16:08:55 +02:00
504d01b61e Merge pull request #90403 from bruvzg/file_resize
[FileAccess] Implement `resize` method.
2024-04-22 12:51:55 +02:00
764de7fe31 Collapse the gdextension arguments into the GDExtensionData struct
This is used to reduce the number of arguments to `OS::open_dynamic_library(...)`.
2024-04-19 07:56:02 -07:00
ede88cf59d Fix loading GDExtension dependencies on Android 2024-04-19 07:55:08 -07:00
7210d6cb43 Merge pull request #90358 from KoBeWi/finding_errors_in_other_apps
Add `OS.get_process_exit_code()` method
2024-04-16 13:30:41 +02:00
dce4a3e4c2 Add get_process_exit_code() method 2024-04-16 12:46:15 +02:00
88b3e68f93 [FileAccess] Implement resize method. 2024-04-12 19:20:49 +03:00
57fde36f31 [Unix / DirAccess] Fix removing directory symlinks with remove, ensure erase_contents_recursive is not following directory symlinks. 2024-04-12 10:06:49 +03:00
b73e740786 Add renaming of PDB files to avoid blocking them 2024-04-05 00:14:23 +03:00
082b420c0a Implement OS.execute_with_pipe method to run process with redirected stdio.
Implement `pipe://*` path handling for creation of named pipes.
2024-03-27 11:41:16 +02:00
b0d07b1bc2 Merge pull request #86936 from akx/env-utf-8
Attempt parsing environment variables as UTF-8
2024-03-11 14:02:22 +01:00
32877ae994 fix FileAccessUnix on OpenBSD: there is no UF_HIDDEN
Part of the joint effort with @rfht to port Godot 4 on OpenBSD.
2024-03-01 19:33:49 +00:00
a8bc9f3e78 Add const lvalue ref to core/* container parameters 2024-02-14 11:20:36 -03:00
bd70b8e1f6 Add THREADS_ENABLED macro in order to compile Godot to run on the main thread 2024-01-17 13:58:29 -05:00
a4c5dae8cb Attempt to parse environment variables as UTF-8 2024-01-07 19:53:43 +02:00
5d44c85d4c Merge pull request #84107 from BlueCube3310/file-access-optimization
Use platform-specific methods for FileAccess reading and writing
2024-01-04 16:39:47 +01:00
c921b6587c Merge pull request #84469 from time-killer-games/patch-1
Fix NetBSD executable path
2024-01-04 14:25:46 +01:00
fe6b073811 Distinguishs between dynamic library not found and can't be opened. 2024-01-01 20:01:57 +08:00
52da1e9b6b Fix NetBSD Executable Path 2023-11-06 06:33:36 -08:00
a039d0b61a Linux: Disable RTLD_DEEPBIND mode for dlopen() in sanitizer builds 2023-10-30 16:16:08 -05:00