summaryrefslogtreecommitdiff
path: root/src/fileio.cpp
AgeCommit message (Collapse)Author
2021-07-02Change: move sensitive information to secrets.cfg and private information to ↵Patric Stout
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.
2021-06-18Fix #9358: Don't skip empty files in tar (#9367)SamuXarick
2021-06-13Codechange: convert printf DEBUG statements to fmt Debug statementsrubidium42
2021-06-10Add: '-X' option to ignore global folders in the search path (#9341)Patric Stout
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'.
2021-05-08Cleanup: remove the old FIO slot functionsRubidium
2021-05-08Codechange: introduce SpriteFile to be used by the sprite loader instead of ↵Rubidium
the global FIO slot functionality
2021-05-08Codechange: let NewGRF sounds make use of RandomAccessFile instead of the ↵Rubidium
FIO slot functions
2021-05-08Codechange: use the new RandomAccessFile as backend for the FIO slot functionsRubidium
2021-05-03Codechange: Replace FOR_ALL_SEARCHPATHS with range-based for loopsglx22
2021-05-03Codechange: Replace FOR_ALL_TARS with range-based for loopsglx22
2021-04-07Fix #8713: Change OTTD2FS and FS2OTTD to return string objects instead of ↵Niels Martin Hansen
static buffers
2021-04-02Fix: Freeing LanguagePack with wrong size.milek7
2021-03-28Fix #8886: Don't try to resolve folders within tars named '.'Charles Pigott
2021-02-23Remove: [Win32] Last pretenses of being able to build for Windows 95Niels Martin Hansen
2021-01-08Codechange: Remove min/max functions in favour of STL variants (#8502)Charles Pigott
2021-01-03Codechange: [OSX] Re-arrange the OSX video driver code by combining all ↵Michael Lutz
drawing code and moving the window/event handling to a different file. This is just a code move/rename, not a functionality change.
2021-01-03Add: always set PERSONAL_DIR "/content_download" in search path (#8481)Patric Stout
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.
2021-01-02Codechange: Drop libxdg-basedir dependency in favour of finding the ↵Charles Pigott
directories ourselves
2020-12-27Codechange: Use std::string in file scanners.Michael Lutz
2020-12-27Codechange: Keep filenames of loaded Fio files in std::strings.Michael Lutz
2020-12-27Codechange: Use automatic memory management for language pack reading.Michael Lutz
2020-12-27Codechange: Even more std::string usage in file IO.Michael Lutz
2020-12-27Codechange: Convert some more FIO functions to take std::string.Michael Lutz
2020-12-27Codechange: Use std::string in FIO search path handling.Michael Lutz
2020-12-27Codechange: Store file search paths as std::string.Michael Lutz
2020-12-27Codechange: Stringify config file paths.Michael Lutz
2020-12-27Codechange: Replace assert_compile macro with static_assertCharles Pigott
2020-12-21Remove: Remnants of PSP support.Michael Lutz
No active target is that limited in concurrent file descriptors.
2020-12-13Fix: set SP_WORKING_DIR earlier with '-c'Patric Stout
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.
2020-12-13Fix: change the working-dir searchpath when using '-c'Patric Stout
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.
2020-12-13Codechange: to create or not to create a folder, that is the questionPatric Stout
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.
2020-07-28Change: Log when rejecting a TAR archive for extractionNiels Martin Hansen
Based on report in <https://www.tt-forums.net/viewtopic.php?f=31&t=87374>
2020-06-22Fix #8230: Resolve ".." when opening files in .tar (#8231)glx22
2020-05-21Codechange: Store info about the dedicated server log file in globals with ↵Michael Lutz
automatic destruction to simplify control flow in openttd_main.
2020-02-19Fix #6399: Create parent directories if they don't already existCharles Pigott
2019-11-10Cleanup: Removed SVN headersS. D. Cloudt
2019-07-21Codechange: Remove unused FioTarFirstDir and FioTarAddLink functionsAlberth
2019-04-10Codechange: Use null pointer literal instead of the NULL macroHenry Wilson
2019-03-20Remove: ENABLE_NETWORK switchPatric Stout
This switch has been a pain for years. Often disabling broke compilation, as no developer compiles OpenTTD without, neither do any of our official binaries. Additionaly, it has grown so hugely in our codebase, that it clearly shows that the current solution was a poor one. 350+ instances of "#ifdef ENABLE_NETWORK" were in the code, of which only ~30 in the networking code itself. The rest were all around the code to do the right thing, from GUI to NewGRF. A more proper solution would be to stub all the functions, and make sure the rest of the code can simply assume network is available. This was also partially done, and most variables were correct if networking was disabled. Despite that, often the #ifdefs were still used. With the recent removal of DOS, there is also no platform anymore which we support where networking isn't working out-of-the-box. All in all, it is time to remove the ENABLE_NETWORK switch. No replacement is planned, but if you feel we really need this option, we welcome any Pull Request which implements this in a way that doesn't crawl through the code like this diff shows we used to.
2019-03-19Remove: DOS supportPatric Stout
In 10 years there was no active development on DOS. Although it turned out to still work, the FPS was very bad. There is little interest in the current community to look into this. Further more, we like to switch to c++11 functions for threads, which are not implemented by DJGPP, the only current compiler for DOS. Additionally, DOS is the only platform which does not support networking. It is the reason we have tons of #ifdefs to support disabling networking. By removing DOS support, we can both use c++11 functions for threads, and remove all the code related to disabling network. Sadly, this means we have to see DOS go. Of course, if you feel up for the task, simply revert this commit, and implement stub c++11 functions for threads and stub functions for networking. We are more than happy to accept such Pull Request.
2019-03-11Codechange: check if a define is set directly, instead of indirectlyPatric Stout
config.lib happens to set GLOBAL_DATA_DIR in case it is not DOS and not OS2, but this kind of deduction is annoying to maintain. It is better to just check if the define you want to use is set, and leave it to config.lib to set it or not depending on the OS.
2019-03-11Codechange: "basedir.h" is a system include, not a localPatric Stout
2019-03-05Remove: MorphOS / AmigaOS supportPatric Stout
In 10 years there is no commit to change how MorphOS works, and we have no active maintainer for it. It is unlikely it works in its current state (but not impossible). With the arrival of SDL2 (and removal of SDL), MorphOS is no longer support. There is an SDL2 port for MorphOS, but it is not maintained by upstream SDL2, and nobody can currently test it out. If anyone wants to re-add MorphOS, please do (revert this patch, fix the problems, and create a Pull Request). If you need any help doing so, let us know! It is not that we don't like MorphOS, it is that we don't have anyone fixing the problems :(
2018-12-27Fix: [Win32] WIN32 may not be defined, always prefer the compiler predefined ↵glx
macro _WIN32
2018-10-31Doc: Lots and lots of doxymentation fixesCharles Pigott
2018-06-05Codechange: Make FioCreateDirectory publicNiels Martin Hansen
2018-04-29Remove: WinCE supportPatric Stout
2017-12-27(svn r27954) -Cleanup [FS#6644]: Remove unused function (M3Henry)frosch
2017-08-13(svn r27893) -Codechange: Use fallthrough attribute. (LordAro)frosch
2017-06-22(svn r27886) -Fix [FS#6575-ish]: Do not modify argv[0].frosch