summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-01-10 10:48:15 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-01-10 10:48:15 +0100
commit0231b4a0e8f9a7582446b0ff2d52e493277c5eec (patch)
treee8f98d390025940c6a2d5707acd8fd23b14b6bf8
parent2d2902b49befbcdc86a7a6357c1f5b4e4c6ddac0 (diff)
parentea11ffc88c22dea2b71d7863808cd65f64f9eded (diff)
Merge pull request #70726 from heppocogne/Fix-open_compressed-get_path
Fix `get_path()` is not working when files are opend with `open_compressed`
-rw-r--r--core/io/file_access_compressed.cpp16
-rw-r--r--core/io/file_access_compressed.h3
2 files changed, 19 insertions, 0 deletions
diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp
index c9e0c2c638..c256668af0 100644
--- a/core/io/file_access_compressed.cpp
+++ b/core/io/file_access_compressed.cpp
@@ -184,6 +184,22 @@ bool FileAccessCompressed::is_open() const {
return f.is_valid();
}
+String FileAccessCompressed::get_path() const {
+ if (f.is_valid()) {
+ return f->get_path();
+ } else {
+ return "";
+ }
+}
+
+String FileAccessCompressed::get_path_absolute() const {
+ if (f.is_valid()) {
+ return f->get_path_absolute();
+ } else {
+ return "";
+ }
+}
+
void FileAccessCompressed::seek(uint64_t p_position) {
ERR_FAIL_COND_MSG(f.is_null(), "File must be opened before use.");
diff --git a/core/io/file_access_compressed.h b/core/io/file_access_compressed.h
index 53b4887b90..136fcede06 100644
--- a/core/io/file_access_compressed.h
+++ b/core/io/file_access_compressed.h
@@ -73,6 +73,9 @@ public:
virtual Error open_internal(const String &p_path, int p_mode_flags) override; ///< open a file
virtual bool is_open() const override; ///< true when file is open
+ virtual String get_path() const override; /// returns the path for the current open file
+ virtual String get_path_absolute() const override; /// returns the absolute path for the current open file
+
virtual void seek(uint64_t p_position) override; ///< seek to a given position
virtual void seek_end(int64_t p_position = 0) override; ///< seek from the end of file
virtual uint64_t get_position() const override; ///< get position in the file