summaryrefslogtreecommitdiffstats
path: root/drivers/unix/file_access_unix.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge commit godotengine/godot@d09d82d433b03bb3773fd2a8cc8d6ccc2f8739ceSpartan3222024-11-261-1/+1
|\
| * Merge pull request #96399 from andyprice/filepermsThaddeus Crews2024-11-211-1/+1
| |\ | | | | | | | | | Unix: Don't create world-writable files when safe save is enabled
| | * unix: Don't create world-writable files when safe save is enabledAndrew Price2024-09-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge commit godotengine/godot@0f5f3bc9546b46b2029fc8896dc859697f1eab97Spartan3222024-11-111-0/+41
|\| |
| * | Warn on filesystem case mismatchValentin Cocaud2024-11-081-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Fix copyright headers referring to GodotSpartan3222024-10-271-2/+2
| | |
* | | Rebrand preambles to RedotDubhghlas McLaughlin2024-10-111-0/+2
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Credits: Co-authored-by: Skogi <skogi.b@gmail.com> Co-authored-by: Spartan322 <Megacake1234@gmail.com> Co-authored-by: swashberry <swashdev@pm.me> Co-authored-by: Christoffer Sundbom <christoffer_karlsson@live.se> Co-authored-by: Dubhghlas McLaughlin <103212704+mcdubhghlas@users.noreply.github.com> Co-authored-by: McDubh <103212704+mcdubhghlas@users.noreply.github.com> Co-authored-by: Dubhghlas McLaughlin <103212704+mcdubhghlas@users.noreply.github.com> Co-authored-by: radenthefolf <radenthefolf@gmail.com> Co-authored-by: John Knight <80524176+Tekisasu-JohnK@users.noreply.github.com> Co-authored-by: Adam Vondersaar <adam.vondersaar@uphold.com> Co-authored-by: decryptedchaos <nixgod@gmail.com> Co-authored-by: zaftnotameni <122100803+zaftnotameni@users.noreply.github.com> Co-authored-by: Aaron Benjamin <lifeartstudios@gmail.com> Co-authored-by: wesam <108880473+wesamdev@users.noreply.github.com> Co-authored-by: Mister Puma <MisterPuma80@gmail.com> Co-authored-by: Aaron Benjamin <lifeartstudios@gmail.com> Co-authored-by: SingleError <isaaconeoneone@gmail.com> Co-authored-by: Bioblaze Payne <BioblazePayne@gmail.com>
* / Fix slow editor load on large projects (v2)Hilderin2024-09-251-1/+0
|/
* Reduce code duplication in FileAccessBlueCube33102024-09-011-91/+2
|
* Fix reload of GDExtension libraries in framework package on macosJoel Croteau2024-08-081-1/+1
| | | | | | | | | | | | | | | | | | | | | `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.
* [FileAccess] Implement `resize` method.bruvzg2024-04-121-0/+17
|
* fix FileAccessUnix on OpenBSD: there is no UF_HIDDENOmar Polo2024-03-011-2/+2
| | | | Part of the joint effort with @rfht to port Godot 4 on OpenBSD.
* Use platform-specific methods for FileAccess reading and writingBlueCube33102023-10-291-0/+75
|
* Windows: Remove `MSVC` define redundant with `_MSC_VER`Rémi Verschelde2023-09-261-17/+0
| | | | Cleanup unused MSVC code in FileAccessUnix.
* [Drivers,Platform] Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicableA Thousand Ships2023-09-121-10/+10
|
* [FileAccess] Add methods to get/set "hidden" and "read-only" attributes on ↵bruvzg2023-08-081-3/+71
| | | | macOS/BSD and Windows.
* Fix file permissions for the web platformAdam Scott2023-07-251-4/+1
|
* [Unix] Fix temporary file permissions.bruvzg2023-06-161-0/+4
|
* Enable shadow warnings and fix raised errorsNinni Pipping2023-05-111-6/+6
|
* Fix Unix temp file creations when using is_backup_save_enabled.bruvzg2023-03-181-5/+17
|
* Merge pull request #73156 from gw2cc/safe_saveYuri Sizov2023-03-161-1/+6
|\ | | | | Create a safe temporary file with is_backup_save_enabled
| * Create a safe temporary file with is_backup_save_enabledACB2023-03-151-1/+6
| |
* | Restore FileAccess.close method.bruvzg2023-02-161-0/+4
|/
* One Copyright Update to rule them allRémi Verschelde2023-01-051-29/+29
| | | | | | | | | | | | | | | | | | | | As many open source projects have started doing it, we're removing the current year from the copyright notice, so that we don't need to bump it every year. It seems like only the first year of publication is technically relevant for copyright notices, and even that seems to be something that many companies stopped listing altogether (in a version controlled codebase, the commits are a much better source of date of publication than a hardcoded copyright statement). We also now list Godot Engine contributors first as we're collectively the current maintainers of the project, and we clarify that the "exclusive" copyright of the co-founders covers the timespan before opensourcing (their further contributions are included as part of Godot Engine contributors). Also fixed "cf." Frenchism - it's meant as "refer to / see".
* Merge pull request #66720 from qarmin/unintialized_memoryRémi Verschelde2022-10-051-4/+4
|\ | | | | | | Remove usage of unitialized variables
| * Remove usage of unitialized variablesRafał Mikrut2022-10-011-4/+4
| |
* | Unix: Remove now unnecessary I/O defines, cleanupRémi Verschelde2022-10-031-19/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - `LIBC_FILEIO_ENABLED` wasn't defined anywhere, even in _other platforms_. - `NO_NETWORK` is also never defined. It probably isn't enough anyway to disable network APIs in the current codebase. - `UNIX_SOCKET_UNAVAILABLE` is never defined in this code but used by some other platforms, clarify that. - `NO_STATVFS` can be removed as Android supports it since API level 19, which is our current min SDK level. It's also only used for `DirAccessUnix::get_space_left()` which is anyway overridden by `DirAccessJAndroid::get_space_left()` so it shouldn't make a difference. * Fixed documentation for `DirAccess.get_space_left()`. - `NO_FCNTL` is likely also a remnant of early Android days, in current NDK r23 it seems to be available. Also cleaned up unused `fcntl.h` includes. - `NO_ALLOCA` is never defined, and we use alloca in many places now.
* | Replace File/Directory with FileAccess/DirAccesskobewi2022-09-191-1/+1
|/
* Code quality: Fix header guards consistencyRémi Verschelde2022-07-251-1/+1
| | | | | Adds `header_guards.sh` bash script, used in CI to validate future changes. Can be run locally to fix invalid header guards.
* Add full support for Android scoped storage.Fredia Huya-Kouadio2022-07-051-4/+0
| | | | | This was done by refactoring directory and file access handling for the Android platform so that any general filesystem access type go through the Android layer. This allows us to validate whether the access is unrestricted, or whether it falls under scoped storage and thus act appropriately.
* Remove or make private `FileAccess` `close()` methods.bruvzg2022-04-121-6/+3
|
* Make FileAccess and DirAccess classes reference counted.bruvzg2022-04-111-1/+1
|
* Style: Cleanup single-line blocks, semicolons, dead codeRémi Verschelde2022-02-161-4/+5
| | | | | Remove currently unused implementation of TextureBasisU, could be re-added later on if needed and ported.
* Update copyright statements to 2022Rémi Verschelde2022-01-031-2/+2
| | | | Happy new year to the wonderful Godot community!
* Replace String comparisons with "", String() to is_empty()Nathan Franke2021-12-091-1/+1
| | | | | | Also: - Adds two stress tests to test_string.h - Changes to .empty() on std::strings
* Only print message for `get_modified_time()` failure when in verbose modeHugo Locurcio2021-12-011-1/+2
| | | | | | | | This error message was often displayed for no good reason when PCK files were loaded in the editor. Since file modification dates are secondary metadata, it's not very important if it can't be retrieved successfully anyway.
* Implement Resource UIDsreduz2021-07-241-1/+1
| | | | | | | | | | | | | | | | | | | | * Most resource types now have unique identifiers. * Applies to text, binary and imported resources. * File formats reference both by text and UID (when available). UID always has priority. * Resource UIDs are 64 bits for better compatibility with the engine. * Can be represented and used textually, example `uuid://dapwmgsmnl28u`. * A special binary cache file is used and exported, containing the mappings. Example of how it looks: ```GDScript [gd_scene load_steps=2 format=3 uid="uid://dw86wq31afig2"] [ext_resource type="PackedScene" uid="uid://bt36ojelx8q6c" path="res://subscene.scn" id="1_t56hs"] ``` GDScript, shaders and other special resource files can't currently provide UIDs, but this should be doable with special keywords on the files. This will be reserved for future PRs.
* FileAccess: Don't err in `store_buffer` with buffer of size 0Rémi Verschelde2021-06-071-1/+1
| | | | | | | | | | | The error check was added for `FileAccessUnix` but it's not an error when both `p_src` and `p_length` are zero. Added correct error checks to all implementations to prevent the actual erroneous case: `p_src` is nullptr but `p_length > 0` (risk of null pointer indexing). Fixes #33564.
* Rename File::get_len() get_length()Marcel Admiraal2021-05-251-1/+1
|
* Make all file access 64-bit (uint64_t)Pedro J. Estébanez2021-05-171-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the types of a big number of variables. General rules: - Using `uint64_t` in general. We also considered `int64_t` but eventually settled on keeping it unsigned, which is also closer to what one would expect with `size_t`/`off_t`. - We only keep `int64_t` for `seek_end` (takes a negative offset from the end) and for the `Variant` bindings, since `Variant::INT` is `int64_t`. This means we only need to guard against passing negative values in `core_bind.cpp`. - Using `uint32_t` integers for concepts not needing such a huge range, like pages, blocks, etc. In addition: - Improve usage of integer types in some related places; namely, `DirAccess`, core binds. Note: - On Windows, `_ftelli64` reports invalid values when using 32-bit MinGW with version < 8.0. This was an upstream bug fixed in 8.0. It breaks support for big files on 32-bit Windows builds made with that toolchain. We might add a workaround. Fixes #44363. Fixes godotengine/godot-proposals#400. Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
* Allow nullptr with zero length in FileAccess get_bufferAlex Hirsch2021-03-161-1/+1
| | | | fix #47071
* Add parameter checkes to FileAccess get_buffer functionsAlex Hirsch2021-03-091-0/+2
| | | | fix #46540
* Update copyright statements to 2021Rémi Verschelde2021-01-011-2/+2
| | | | | | | | | | | | | | Happy new year to the wonderful Godot community! 2020 has been a tough year for most of us personally, but a good year for Godot development nonetheless with a huge amount of work done towards Godot 4.0 and great improvements backported to the long-lived 3.2 branch. We've had close to 400 contributors to engine code this year, authoring near 7,000 commit! (And that's only for the `master` branch and for the engine code, there's a lot more when counting docs, demos and other first-party repos.) Here's to a great year 2021 for all Godot users 🎆
* Reorganized core/ directory, it was too fatty alreadyreduz2020-11-071-1/+1
| | | | | | -Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
* [Complex Test Layouts] Change `String` to use UTF-32 encoding on all platforms.bruvzg2020-09-031-1/+1
|
* Style: Enforce braces around if blocks and loopsRémi Verschelde2020-05-141-11/+18
| | | | | Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
* Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde2020-05-141-23/+0
| | | | | | | | | | | | | | Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
* Port member initialization from constructor to declaration (C++11)Rémi Verschelde2020-05-141-7/+0
| | | | | | | | | | Using `clang-tidy`'s `modernize-use-default-member-init` check and manual review of the changes, and some extra manual changes that `clang-tidy` failed to do. Also went manually through all of `core` to find occurrences that `clang-tidy` couldn't handle, especially all initializations done in a constructor without using initializer lists.
* Replace NULL with nullptrlupoDharkael2020-04-021-6/+6
|
* Update copyright statements to 2020Rémi Verschelde2020-01-011-2/+2
| | | | | | | | | | | Happy new year to the wonderful Godot community! We're starting a new decade with a well-established, non-profit, free and open source game engine, and tons of further improvements in the pipeline from hundreds of contributors. Godot will keep getting better, and we're looking forward to all the games that the community will keep developing and releasing with it.