Commit Graph

230 Commits (88324a253ecb5bc0b458d2c726e0696434cb291e)

Author SHA1 Message Date
Jonathan G Rennison 88324a253e
Fix #11644: Off by one error/buffer over-read in StrMakeValid (#11645)
* Fix #11644: Off by one error in StrMakeValid UTF-8 decode overrun detection

* Fix #11644: Off by one error in StrMakeValid buffer last character

* Fix: Unnecessary string duplication at StrMakeValid call sites
5 months ago
Patric Stout c059ce0c97
Fix cda6f24f: don't ignore binary-dir if it happens to be working-dir (#11431)
Some of our code ignores the SP_WORKING_DIR for some actions, which
means that if, for example, your SP_BINARY_DIR is the same as your
SP_WORKING_DIR, neither is scanned.

Instead, only add SP_WORKING_DIR if it is unique.
7 months ago
Peter Nelson cda6f24fe8
Change: Filter duplicate paths from valid search path list. (#11363) 8 months ago
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 9 months ago
Owen Rudge 1a3d1bca59 Remove: OS/2 port 12 months ago
Rubidium 81f957b9f8 Codechange: use std::string to find the executable's working directory 12 months ago
Rubidium 993f90b6a0 Codechange: let GenerateDefaultSaveName return std::string 1 year ago
Rubidium 513ede7669 Codechange: use C++ strings/paths to resolve links in tars 1 year ago
Rubidium 13789d1703 Codechange: use std::string for FiosIsValidFile 1 year ago
Peter Nelson 56085be9bd Codechange: Move includes for common STL headers to stdafx. 1 year ago
Rubidium 98972a0748 Codechange: use C++ strings for constructing script file paths 1 year ago
Peter Nelson e6740046ee Codechange: Use range-for iteration. 1 year ago
Rubidium 4dd5f994be Codechange: replace strncasecmp with case ignoring variant of StrStarts/EndsWith 1 year ago
Rubidium 86786a7af6 Codechange: introduce StrEqualsIgnoreCase/StrCompareIgnoreCase to replace strcasecmp 1 year ago
Charles Pigott 80bd5ad727
Codechange: Use std::strto* variants everywhere (#10720) 1 year ago
Rubidium 43c65a3fec Codechange: use std::string for base media filename/warning storage 1 year ago
Rubidium 4e65ec1dc4 Codechange: do not declare functions in blocks 1 year ago
Eddi-z 8db4892f49
Codechange: Reshuffle debuglevels in fileio to address spammyness (#10240) 1 year ago
Rubidium 3e4d327451 Codechange: use the C++ std::getenv over the POSIX/C getenv
The C++ std::getenv is guaranteed thread-safe by the C++11 specification,
whereas the POSIX/C getenv might not be thread-safe by the C11 specification.
3 years ago
Patric Stout 75b6051b7a Change: move sensitive information to secrets.cfg and private information to private.cfg
We often ask people for their openttd.cfg, which now includes their
passwords, usernames, etc. It is easy for people to overlook this,
unwillingly sharing information they shouldn't.

By splitting this information over either private.cfg or secrets.cfg,
we make it more obvious they shouldn't be sharing those files, and
hint to what is inside them.
3 years ago
SamuXarick 1e6a2163a5
Fix #9358: Don't skip empty files in tar (#9367) 3 years ago
rubidium42 55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 3 years ago
Patric Stout ed3946e295
Add: '-X' option to ignore global folders in the search path (#9341)
This is extreme useful for automated testing. Without this, OpenTTD
will always look in your personal-dir (like ~/.local/share/openttd
or %USER%\Documents\OpenTTD). For most users this is exactly what
we want, that there is a shared place for all their files.

However, for automated testing this is rather annoying, as your
local development files influence the automated test. As such,
'-X' counters this, and only gives the local folders. This is
especially useful in combination with '-x' and '-c'.
3 years ago
Rubidium fa6abe1646 Cleanup: remove the old FIO slot functions 3 years ago
Rubidium fdc11a9f94 Codechange: introduce SpriteFile to be used by the sprite loader instead of the global FIO slot functionality 3 years ago
Rubidium c097bc9d7d Codechange: let NewGRF sounds make use of RandomAccessFile instead of the FIO slot functions 3 years ago
Rubidium b144e56b2c Codechange: use the new RandomAccessFile as backend for the FIO slot functions 3 years ago
glx22 983c7ade60 Codechange: Replace FOR_ALL_SEARCHPATHS with range-based for loops 3 years ago
glx22 34215f7faa Codechange: Replace FOR_ALL_TARS with range-based for loops 3 years ago
Niels Martin Hansen e0561dbded Fix #8713: Change OTTD2FS and FS2OTTD to return string objects instead of static buffers 3 years ago
milek7 295f34a9df Fix: Freeing LanguagePack with wrong size. 3 years ago
Charles Pigott 2d7b34bc68 Fix #8886: Don't try to resolve folders within tars named '.' 3 years ago
Niels Martin Hansen beeb9e0a1b Remove: [Win32] Last pretenses of being able to build for Windows 95 3 years ago
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 3 years ago
Michael Lutz 9ccef816f9 Codechange: [OSX] Re-arrange the OSX video driver code by combining all drawing code and moving the window/event handling to a different file.
This is just a code move/rename, not a functionality change.
3 years ago
Patric Stout ab7da117e0
Add: always set PERSONAL_DIR "/content_download" in search path (#8481)
This means that if you start OpenTTD with "-c" to indicate another
location to store files, it can still read the content you already
downloaded from your PERSONAL_DIR. This folder is, however,
read-only.

This is useful for situations where you downloaded OpenGFX via
the content-service, but want to run the regression or want to
run with a clean configuration. With this change, you no longer
need to download OpenGFX again.
3 years ago
Charles Pigott 3dfee979a7 Codechange: Drop libxdg-basedir dependency in favour of finding the directories ourselves 3 years ago
Michael Lutz b408fe77f7 Codechange: Use std::string in file scanners. 3 years ago
Michael Lutz 358056ec42 Codechange: Keep filenames of loaded Fio files in std::strings. 3 years ago
Michael Lutz 024a3f6259 Codechange: Use automatic memory management for language pack reading. 3 years ago
Michael Lutz 5cbb2da794 Codechange: Even more std::string usage in file IO. 3 years ago
Michael Lutz 65f65ad2ad Codechange: Convert some more FIO functions to take std::string. 3 years ago
Michael Lutz f3326d34e7 Codechange: Use std::string in FIO search path handling. 3 years ago
Michael Lutz 0c6e8a8123 Codechange: Store file search paths as std::string. 3 years ago
Michael Lutz dd138fc460 Codechange: Stringify config file paths. 3 years ago
Charles Pigott 860c270c73 Codechange: Replace assert_compile macro with static_assert 3 years ago
Michael Lutz 5575cb9133 Remove: Remnants of PSP support.
No active target is that limited in concurrent file descriptors.
3 years ago
Patric Stout b7851e51ad Fix: set SP_WORKING_DIR earlier with '-c'
On Windows, relative folders don't work so well. So we need to
lookup the full path. This is best done in DetermineBasePaths()
and as a bonus that only sets SP_WORKING_DIR once.
4 years ago
Patric Stout da7c74ba7e Fix: change the working-dir searchpath when using '-c'
Basically, with '-c' you now create a sandbox. It will still use
your personal-dir and global-dir to find files you installed there,
but all new files are stored with a base folder identical to the
folder the configuration is in.

This is a bit of an old bug, that we many have tried to solve in
various of different ways. The code has grown sufficiently complex
that it is hard to see what consequences of actions are. This is
in my opinion the most harmless solution, while increasing the
usefulness of the '-c' flag.

In essence, the problem was that empty folders were always created
in the directory where the configuration was, but as that directory
wasn't added to any searchpath, files weren't stored there, unless
by accident it was a folder already on the searchpath. For example,
if you do './openttd -c local.cfg', it did work as expected. But
in the more generic variant, it did not.

With this patch, you can run './openttd -c /new/folder/local.cfg',
and it will create and prepare that folder to receive new files.

'content_download' is also stored in the directory the
configuration is in; this was already the case. Important to
note that there is only one search-path for 'content_download'.
In other words, when using '-c', it will not look in '~/.openttd'
inside the 'content_download' folder.
4 years ago
Patric Stout 4e12aac9c0 Codechange: to create or not to create a folder, that is the question
This was just weird. With XDG _personal_dir was created already,
but later on it was checked if it was different from config_dir,
and the creation was skipped. All this checking and validation
makes my head spin .. let's make it a bit more simple.
4 years ago