SFTtech/openage

Temporary file/directory support

Open

#1,540 建立於 2023年9月17日

在 GitHub 查看
 (9 留言) (0 反應) (0 負責人)Python (12,130 star) (1,135 fork)batch import
area: assetsgood first issuelang: c++lang: pythonnice new thing ☺

描述

Required Skills: Python or C++

Difficulty: Easy

It would be nice if we could create temporary files/directories in our current file system abstraction API. We currently only use temporary structures in the converter, but they could be useful in other places, e.g. for unzipping archives or on-disk caching.

Creation of temporary files could be implemented in our Python file API or our C++ file API or in both. The Python-side implementation is more preferrable at the moment, since the converter is written Python and temporary files already have an active use case there.

The easiest way to implement support probably is to add a method that calls the underlying system libraries for temporary file/directory creation:

  • Python: tempfile module
  • C++: std::filesystem and std::tmpfile

The retrieved path is then wrapped in our Path/Directory classes and returned by the method.

Tasks:

  • Create temp file/dir and wrap them in openage file system API (Python)
  • Create temp file/dir and wrap them in openage file system API (C++)
  • Delete temp file/dir explicitely when object is destroyed
  • Use new implementation in code (currently only in converter)
  • (optional) Add method for checking if a file/dir is temporary

Further Reading

貢獻者指南

Temporary file/directory support · SFTtech/openage#1540 | Good First Issue