Commit graph

125 commits

Author SHA1 Message Date
Alex Hirsch
0b541af8a1
Allow nullptr with zero length in FileAccess get_buffer
fix #47071

(cherry picked from commit c28428fe4d)
2021-03-17 15:17:02 +01:00
Alex Hirsch
5a882a659a
Add parameter checkes to FileAccess get_buffer functions
fix #46540

(cherry picked from commit cdf3099c68)
2021-03-14 12:03:22 +01:00
Pedro J. Estébanez
6d89f675b1 Modernize Thread
- Based on C++11's `thread` and `thread_local`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed (except for the few cases of non-portable functions)
- Simpler for `NO_THREADS`
- Thread ids are now the same across platforms (main is 1; others follow)
2021-02-18 11:58:08 +01:00
Pedro J. Estébanez
8f6a636ae7 Modernize Semaphore
- Based on C++11's `mutex` and `condition_variable`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed
- Simpler for `NO_THREADS`
2021-02-18 11:58:08 +01:00
Pedro J. Estébanez
4ddcdc031b Modernize Mutex
- Based on C++11's `mutex`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed
- Simpler for `NO_THREADS`
- `BinaryMutex` added for special cases as the non-recursive version
- `MutexLock` now takes a reference. At this point the cases of null `Mutex`es are rare. If you ever need that, just don't use `MutexLock`.
- `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same.
2021-02-18 11:58:08 +01:00
Pedro J. Estébanez
b450036120 Modernize RWLock
- Based on C++14's `shared_time_mutex`
- No more need to allocate-deallocate or check for null
- No pointer anymore, just a member variable
- Platform-specific implementations no longer needed
- Simpler for `NO_THREADS`
2021-02-18 11:41:07 +01:00
Rémi Verschelde
49646383f1
Update copyright statements to 2021
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 🎆

(cherry picked from commit b5334d14f7)
2021-01-13 16:17:06 +01:00
Nathan Franke
b9e1db7e03
Revert "Fix Directory Open Check"
This reverts commit 3f898f5207.
2020-07-28 13:54:13 -04:00
Nathan Franke
3f898f5207 Fix Directory Open Check
(cherry picked from commit 09aeb7706b)
2020-07-08 09:01:57 +02:00
Rémi Verschelde
7bf9787921 SCons: Format buildsystem files with psf/black
Configured for a max line length of 120 characters.

psf/black is very opinionated and purposely doesn't leave much room for
configuration. The output is mostly OK so that should be fine for us,
but some things worth noting:

- Manually wrapped strings will be reflowed, so by using a line length
  of 120 for the sake of preserving readability for our long command
  calls, it also means that some manually wrapped strings are back on
  the same line and should be manually merged again.

- Code generators using string concatenation extensively look awful,
  since black puts each operand on a single line. We need to refactor
  these generators to use more pythonic string formatting, for which
  many options are available (`%`, `format` or f-strings).

- CI checks and a pre-commit hook will be added to ensure that future
  buildsystem changes are well-formatted.

(cherry picked from commit cd4e46ee65)
2020-06-10 15:30:52 +02:00
Nathan Franke
219717fc21 fix(Directory): remove erasing print
Fixes #39106

(cherry picked from commit e48fb01d59)
2020-06-04 12:09:39 +02:00
Pedro J. Estébanez
21703aefee Fix res:// trimmed to s:// on Windows 2020-04-01 10:22:05 +02:00
Pedro J. Estébanez
6105dfdac9 Improve UX of drive letters
Namely, move the drive dropdown to just the left of the path text box and don't include the former
in the latter.

This improves the UX on Windows.

In the UNIX case, since its concept of drives is (ab)used to provide shortcuts to useful paths, its
dropdown is kept at the original location.
2020-03-17 14:48:54 +01:00
Rémi Verschelde
a7f49ac9a1 Update copyright statements to 2020
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.
2020-01-01 11:16:22 +01:00
PouleyKetchoupp
90b6062ebb Handle missing file properly when checking for case mismatch
This was causing false alarms to be randomly reported on Windows for files that didn't exist.
2019-11-10 09:51:09 +01:00
Rémi Verschelde
e797ae4704 FileAccessWindows: Add errno include for MinGW
Apparently MSVC is happy with ENOENT without it, but MinGW seems to
require it.
Follow-up to #31499.
2019-08-21 10:52:57 +02:00
PouleyKetchoupp
b49226e085 Support for file not found in ConfigFile::Load and handle a few specific cases
EditorSettings::set_project_metadata: creates project_metadata.cfg if it doesn't exist
EditorPlugin::get_config: removed (not used)

Fixes #31444
2019-08-21 08:32:55 +02:00
Rémi Verschelde
d3153c28f0 Replace last occurrences of 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG'
The last remaining ERR_EXPLAIN call is in FreeType code and makes sense as is
(conditionally defines the error message).

There are a few ERR_EXPLAINC calls for C-strings where String is not included
which can stay as is to avoid adding additional _MSGC macros just for that.

Part of #31244.
2019-08-17 13:31:22 +02:00
Braden Bodily
71d71d55b5 Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in 'core/' and 'editor/'
Condensed some if and ERR statements. Added dots to end of error messages

Couldn't figure out EXPLAINC. These files gave me trouble: core/error_macros.h, core/io/file_access_buffered_fa.h (where is it?),
core/os/memory.cpp,
drivers/png/png_driver_common.cpp,
drivers/xaudio2/audio_driver_xaudio2.cpp (where is it?)
2019-08-17 12:33:15 +02:00
IAmActuallyCthulhu
82b9557803
Remove redundant author doc comments 2019-08-12 04:26:38 -05:00
Rémi Verschelde
68735d2a88 Fix compilation warnings in JS and Windows builds
Warnings raised by Emscripten 1.38.0 and MinGW64 5.0.4 / GCC 8.3.0.

JS can now build with `werror=yes warnings=extra`.
MinGW64 still has a few warnings to resolve with `warnings=extra`,
and only one with `warnings=all`.

Part of #29033 and #29801.
2019-06-15 14:40:45 +02:00
Hugo Locurcio
cbd31d9f0b
Fix errors when attempting to set UNIX permissions when unavailable
This makes exporting from Windows to Linux work again.

This closes #29416.
2019-06-03 14:35:33 +02:00
Juan Linietsky
cd4449e7ab Add FileAccess::set_unix_permissions for Unix platforms 2019-04-07 15:45:30 -03:00
Rémi Verschelde
c8994b56f9 Style: Apply new changes from clang-format 8.0
It seems to stay compatible with formatting done by clang-format 6.0 and 7.0,
so contributors can keep using those versions for now (they will not undo those
changes).
2019-04-09 17:09:48 +02:00
Rémi Verschelde
d65cbddc8d
Merge pull request #27589 from Chaosus/fix_file
Fix File switching between reading and writing, opened with READ_WRITE on Windows
2019-04-08 12:12:19 +02:00
Chaosus
8d12dfa24d Fix File opened with READ_WRITE on Windows
To allows use read and write anytime and in any order
2019-04-05 15:15:40 +03:00
Twarit
501fabe914 Capitalise drive letters
Matches how other application like to display the drive letters
2019-03-10 00:36:54 +05:30
Rémi Verschelde
467f18b738 Fix style issues from recent commits 2019-03-03 12:45:20 +01:00
Juan Linietsky
6dc2669361 Remove some windows prints 2019-03-02 11:58:42 -03:00
Rémi Verschelde
b7cc2bb1e2 Core: Ensure classes match their header filename
Also drop some unused files.

Renamed:
- `core/dvector.h` -> `pool_vector.h`
- `core/io/resource_import.h` -> `resource_importer.h`
- `core/sort.h` -> `sort_array.h`
- `core/string_db.h` -> `string_name.h`

Dropped:
- `core/allocators.h`
- `core/os/shell.h`
- `core/variant_construct_string.cpp`
2019-02-12 13:34:25 +01:00
Rémi Verschelde
c3b0ee5941 Fix code style issues 2019-01-26 22:35:31 +01:00
Hein-Pieter van Braam
a8510331c0 Fix compilation on UWP
It appears that MSVC and Mingw disagree about what conversions are legal
here. We just use the 'wide' version of the call and use our native
CharType instead of TCHAR.
2019-01-26 16:27:10 +01:00
Juan Linietsky
6fa632b821 Add function to obtain filesystem type from DirAccess.
Change EditorFileSystem to not use directory modification times on FAT32, fixes #20946
2019-01-21 18:06:14 -03:00
Marcin Zawiejski
e65bce3083
Replace CreateThread with QueueUserWorkItem
Fixes #24869 stuttering on Windows by reusing long running threadpool threads instead of creating a new thread on each call to Thread::start.
2019-01-19 00:31:10 +01:00
Rémi Verschelde
b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Wilson E. Alvarez
08f22f1cf0
Moved member variables to initializer list 2018-12-11 18:33:01 -05:00
Dualtagh Murray
b902a2f2a7 Fixing warnings generated by MSVC
Fixes #22684.
2018-10-19 11:45:24 +02:00
Rémi Verschelde
3a2ca68af3 SCons: Build thirdparty code in own env, disable warnings
Also remove unnecessary `Export('env')` in other SCsubs,
Export should only be used when exporting *new* objects.
2018-09-28 14:07:39 +02:00
Fabio Alessandrelli
30327872e0 Unify StreamPeerTCP/TCP_Server with NetSocket API 2018-09-12 15:56:20 +02:00
Fabio Alessandrelli
1b99806b47 Unify PacketPeerUDP using NetSocket 2018-09-12 15:56:16 +02:00
Fabio Alessandrelli
7de28be764 ENet wrapper properly detect disconnect on poll
Now PacketPeerUDP.get_available_packet_count() return -1 if the socket
is in error state.
2018-09-12 12:50:53 +02:00
Fabio Alessandrelli
d3108985e0 Properly reset socket blocking state on close 2018-09-12 12:50:53 +02:00
Rémi Verschelde
277b24dfb7 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00
Rémi Verschelde
52466d57e9 Make some debug prints verbose-only, remove others 2018-08-24 14:59:01 +02:00
Juan Linietsky
ea3d997f9d
Revert "added get_creation_time function for gdscript" 2018-08-10 13:29:49 -03:00
Juan Linietsky
275e0d5ee4
Merge pull request #18914 from notwarp/master
added get_creation_time function for gdscript
2018-08-10 13:28:47 -03:00
Rémi Verschelde
7c9f7452f4 Style: Format code with clang-format 6.0.1 2018-07-18 16:27:03 +02:00
Max Hilbrunner
130fd6bcb8
Merge pull request #18279 from RandomShaper/allow-naive-http
Allow body-up-to-EOF HTTP responses
2018-05-26 19:58:39 +02:00
Pedro J. Estébanez
2587fcccee Allow body-up-to-EOF HTTP responses
Implements the same heuristic as Curl (and web browsers): if no `Content-Length`, no `Connection: keep-alive` and no chunked transfer encoding, assume th rest of the data until EOF is the body, gracefully setting the HTTP client back to the disconnected state.

Theoretically, this is not compliant with HTTP 1.1, by which `keep-alive` is the default, but in practice, an explicit header is sent by servers.
2018-05-22 15:08:31 +02:00
Daniele Giuliani
d315b0fb8a added get_creation_time function for gdscript 2018-05-16 00:50:57 +02:00