Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

File Abstraction #2210

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

File Abstraction #2210

wants to merge 13 commits into from

Conversation

SirNate0
Copy link
Contributor

Inspired by #2198, I went ahead and abstracted the packed and unpacked behavior of the File class into two separate classes, and created an abstract base for PackageFile to allow the creation of different kinds of these FileSources (say for a different method of compression or encryption). Presently, I think it is in working order (it hasn't been thoroughly tested, but I checked that some of the samples ran as well as the Editor and NinjaSnowWar), and it only minimally breaks the API. I'm planning on maybe making an example other file source for gzipped files or something, but that hasn't yet been done.

Notable changes required include:

  • Cannot construct a File as it is now an abstract class -- must use a SystemFile instead (assuming this is for reading/writing to the file system, which is the usual use for constructing a File directly).
  • Certain resource cache operations are now FileSource based, not PackageFile based (e.g. GetPackageFiles() presently just returns the vector of FileSources.
  • IsPackaged() was removed from the File class.

@SirNate0
Copy link
Contributor Author

I created an example project here (same basic format as the examples, based on the code from one of them) that creates new file source and file classes to read and write gzipped files.

/// Destruct.
virtual ~FileSource() override { }

/// Check if a file exists within the package file. This should be case-insensitive on Windows and case-sensitive on other platforms.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments still refer to Package File instead of File Source

@github-actions
Copy link

Marking this stale since there has been no activity for 30 days.
It will be closed if there is no activity for another 15 days.

@github-actions github-actions bot added the stale label Mar 21, 2020
@weitjong weitjong added backlog and removed stale labels Mar 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants