Loading

Paste #pckrx0ldj

  1. /**
  2. + * Path of a file that is possibly stored inside another file.
  3. + * The #fs_path points to a file at the file system. This can be either the file expressed by
  4. + * the #FilePath object, or a container file like a tar-file. In the latter case, the
  5. + * #contained_path is the lower-case path to the expressed file inside the container file.
  6. + */
  7. +class FilePath {
  8. +public:
  9. +       FilePath() : fs_path(""), contained_path("") { }
  10. +       FilePath(const std::string &fs_path) : fs_path(fs_path), contained_path("") { }
  11. +       FilePath(const std::string &fs_path, const std::string &contained_path) : fs_path(fs_path), contained_path(strlower(contained_path)) { }
  12. +
  13. +       std::string fs_path;        ///< Path to a file at the file system.
  14. +       std::string contained_path; ///< If not empty, lower-case path inside the #fs_path file.
  15.  
  16.  
  17. diff --git a/src/newgrf_config.h b/src/newgrf_config.h
  18. --- a/src/newgrf_config.h
  19. +++ b/src/newgrf_config.h
  20. @@ -151,13 +151,15 @@ struct GRFTextWrapper : public SimpleCou
  21.  
  22.  /** Information about GRF, used in the game and (part of it) in savegames */
  23.  struct GRFConfig : ZeroedMemoryAllocator {
  24. -       GRFConfig(const char *filename = NULL);
  25. +       GRFConfig();
  26. +       GRFConfig(const FilePath &file_path);
  27.         GRFConfig(const GRFConfig &config);
  28.         ~GRFConfig();
  29.  
  30.         GRFIdentifier ident;                           ///< grfid and md5sum to uniquely identify newgrfs
  31.         uint8 original_md5sum[16];                     ///< MD5 checksum of original file if only a 'compatible' file was loaded
  32. -       char *filename;                                ///< Filename - either with or without full path
  33. +//     char *filename;                                ///< Filename - either with or without full path
  34. +       FilePath file_path;                            ////< Path to the file.
  35.         GRFTextWrapper *name;                          ///< NOSAVE: GRF name (Action 0x08)
  36.         GRFTextWrapper *info;                          ///< NOSAVE: GRF info (author, copyright, ...) (Action 0x08)
  37.         GRFTextWrapper *url;                           ///< NOSAVE: URL belonging to this GRF.

Comments