Skip to content
Snippets Groups Projects
  1. Oct 30, 2020
    • Lioncash's avatar
      General: Make ignoring a discarded return value an error · 26547d3e
      Lioncash authored
      Allows our CI to catch more potential bugs. This also removes the
      [[nodiscard]] attribute of IOFile's Open member function. There are
      cases where a file may want to be opened, but have the status of it
      checked at a later time.
      26547d3e
  2. Oct 21, 2020
  3. Oct 17, 2020
    • Lioncash's avatar
      core: Fix clang build · be1954e0
      Lioncash authored
      Recent changes to the build system that made more warnings be flagged as
      errors caused building via clang to break.
      
      Fixes #4795
      be1954e0
  4. Aug 16, 2020
    • Lioncash's avatar
      common/fileutil: Convert namespace to Common::FS · c4ed7911
      Lioncash authored
      Migrates a remaining common file over to the Common namespace, making it
      consistent with the rest of common files.
      
      This also allows for high-traffic FS related code to alias the
      filesystem function namespace as
      
      namespace FS = Common::FS;
      
      for more concise typing.
      c4ed7911
  5. Aug 15, 2020
    • Lioncash's avatar
      common: Make use of [[nodiscard]] where applicable · df724803
      Lioncash authored
      Now that clang-format makes [[nodiscard]] attributes format sensibly, we
      can apply them to several functions within the common library to allow
      the compiler to complain about any misuses of the functions.
      df724803
  6. Jul 21, 2020
  7. Apr 15, 2020
    • Lioncash's avatar
      file_util: Early-exit in WriteArray and ReadArray if specified lengths are zero · e7733758
      Lioncash authored
      It's undefined behavior to pass a null pointer to std::fread and
      std::fwrite, even if the length passed in is zero, so we must perform
      the precondition checking ourselves.
      
      A common case where this can occur is when passing in the data of an
      empty std::vector and size, as an empty vector will typically have a
      null internal buffer.
      
      While we're at it, we can move the implementation out of line and add
      debug checks against passing in nullptr to std::fread and std::fwrite.
      e7733758
  8. May 23, 2019
    • Lioncash's avatar
      common/file_util: Make GetCurrentDir() return a std::optional · 11e9bee9
      Lioncash authored
      nullptr was being returned in the error case, which, at a glance may
      seem perfectly OK... until you realize that std::string has the
      invariant that it may not be constructed from a null pointer. This
      means that if this error case was ever hit, then the application would
      most likely crash from a thrown exception in std::string's constructor.
      
      Instead, we can change the function to return an optional value,
      indicating if a failure occurred.
      11e9bee9
    • Lioncash's avatar
      common/file_util: Make ReadFileToString and WriteStringToFile consistent · 2b1fcc8a
      Lioncash authored
      Makes the parameter ordering consistent, and also makes the filename
      parameter a std::string. A std::string would be constructed anyways with
      the previous code, as IOFile's only constructor with a filepath is one
      taking a std::string.
      
      We can also make WriteStringToFile's string parameter utilize a
      std::string_view for the string, making use of our previous changes to
      IOFile.
      2b1fcc8a
    • Lioncash's avatar
      common/file_util: Remove unnecessary c_str() calls · e3b25399
      Lioncash authored
      The file stream open functions have supported std::string overloads
      since C++11, so we don't need to use c_str() here. Same behavior, less
      code.
      e3b25399
    • Lioncash's avatar
      common/file_util: Make IOFile's WriteString take a std::string_view · 8cd3d9be
      Lioncash authored
      We don't need to force the usage of a std::string here, and can instead
      use a std::string_view, which allows writing out other forms of strings
      (e.g. C-style strings) without any unnecessary heap allocations.
      8cd3d9be
  9. Feb 07, 2019
  10. Oct 02, 2018
    • Weiyi Wang's avatar
      string_util: remove TString conversion for windows · bfe84f06
      Weiyi Wang authored
      First of all they are foundamentally broken. As our convention is that std::string is always UTF-8, these functions assume that the multi-byte character version of TString (std::string) from windows is also in UTF-8, which is almost always wrong. We are not going to build multi-byte character build, and even if we do, this dirty work should be handled by frontend framework early.
      bfe84f06
  11. Sep 21, 2018
  12. Sep 15, 2018
  13. Aug 12, 2018
  14. Aug 09, 2018
  15. Aug 07, 2018
  16. Aug 01, 2018
  17. Jul 24, 2018
    • Zach Hilman's avatar
      VFS Regression and Accuracy Fixes (#776) · 59cb2584
      Zach Hilman authored
      * Regression and Mode Fixes
      
      * Review Fixes
      
      * string_view correction
      
      * Add operator& for FileSys::Mode
      
      * Return std::string from SanitizePath
      
      * Farming Simulator Fix
      
      * Use != With mode operator&
      59cb2584
  18. Jul 22, 2018
  19. Jul 21, 2018
    • Lioncash's avatar
      file_util: Use an enum class for GetUserPath() · d66b43da
      Lioncash authored
      Instead of using an unsigned int as a parameter and expecting a user to
      always pass in the correct values, we can just convert the enum into an
      enum class and use that type as the parameter type instead, which makes
      the interface more type safe.
      
      We also get rid of the bookkeeping "NUM_" element in the enum by just
      using an unordered map. This function is generally low-frequency in
      terms of calls (and I'd hope so, considering otherwise would mean we're
      slamming the disk with IO all the time) so I'd consider this acceptable
      in this case.
      d66b43da
  20. Jul 19, 2018
  21. Jul 08, 2018
  22. Jul 06, 2018
    • Zach Hilman's avatar
      Virtual Filesystem (#597) · 77c684c1
      Zach Hilman authored
      * Add VfsFile and VfsDirectory classes
      
      * Finish abstract Vfs classes
      
      * Implement RealVfsFile (computer fs backend)
      
      * Finish RealVfsFile and RealVfsDirectory
      
      * Finished OffsetVfsFile
      
      * More changes
      
      * Fix import paths
      
      * Major refactor
      
      * Remove double const
      
      * Use experimental/filesystem or filesystem depending on compiler
      
      * Port partition_filesystem
      
      * More changes
      
      * More Overhaul
      
      * FSP_SRV fixes
      
      * Fixes and testing
      
      * Try to get filesystem to compile
      
      * Filesystem on linux
      
      * Remove std::filesystem and document/test
      
      * Compile fixes
      
      * Missing include
      
      * Bug fixes
      
      * Fixes
      
      * Rename v_file and v_dir
      
      * clang-format fix
      
      * Rename NGLOG_* to LOG_*
      
      * Most review changes
      
      * Fix TODO
      
      * Guess 'main' to be Directory by filename
      77c684c1
  23. Jul 03, 2018
  24. Apr 29, 2018
  25. Apr 28, 2018
  26. Mar 26, 2018
  27. Jan 20, 2018
  28. Dec 22, 2016
  29. Nov 24, 2016
  30. Nov 19, 2016
Loading