file_access_pack.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673
  1. /**************************************************************************/
  2. /* file_access_pack.cpp */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #include "file_access_pack.h"
  31. #include "core/io/file_access_encrypted.h"
  32. #include "core/object/script_language.h"
  33. #include "core/os/os.h"
  34. #include "core/version.h"
  35. Error PackedData::add_pack(const String &p_path, bool p_replace_files, uint64_t p_offset) {
  36. for (int i = 0; i < sources.size(); i++) {
  37. if (sources[i]->try_open_pack(p_path, p_replace_files, p_offset)) {
  38. return OK;
  39. }
  40. }
  41. return ERR_FILE_UNRECOGNIZED;
  42. }
  43. void PackedData::add_path(const String &p_pkg_path, const String &p_path, uint64_t p_ofs, uint64_t p_size, const uint8_t *p_md5, PackSource *p_src, bool p_replace_files, bool p_encrypted, bool p_bundle) {
  44. String simplified_path = p_path.simplify_path().trim_prefix("res://");
  45. PathMD5 pmd5(simplified_path.md5_buffer());
  46. bool exists = files.has(pmd5);
  47. PackedFile pf;
  48. pf.encrypted = p_encrypted;
  49. pf.bundle = p_bundle;
  50. pf.pack = p_pkg_path;
  51. pf.offset = p_ofs;
  52. pf.size = p_size;
  53. for (int i = 0; i < 16; i++) {
  54. pf.md5[i] = p_md5[i];
  55. }
  56. pf.src = p_src;
  57. if (!exists || p_replace_files) {
  58. files[pmd5] = pf;
  59. }
  60. if (!exists) {
  61. // Search for directory.
  62. PackedDir *cd = root;
  63. if (simplified_path.contains_char('/')) { // In a subdirectory.
  64. Vector<String> ds = simplified_path.get_base_dir().split("/");
  65. for (int j = 0; j < ds.size(); j++) {
  66. if (!cd->subdirs.has(ds[j])) {
  67. PackedDir *pd = memnew(PackedDir);
  68. pd->name = ds[j];
  69. pd->parent = cd;
  70. cd->subdirs[pd->name] = pd;
  71. cd = pd;
  72. } else {
  73. cd = cd->subdirs[ds[j]];
  74. }
  75. }
  76. }
  77. String filename = simplified_path.get_file();
  78. // Don't add as a file if the path points to a directory.
  79. if (!filename.is_empty()) {
  80. cd->files.insert(filename);
  81. }
  82. }
  83. }
  84. void PackedData::remove_path(const String &p_path) {
  85. String simplified_path = p_path.simplify_path().trim_prefix("res://");
  86. PathMD5 pmd5(simplified_path.md5_buffer());
  87. if (!files.has(pmd5)) {
  88. return;
  89. }
  90. // Search for directory.
  91. PackedDir *cd = root;
  92. if (simplified_path.contains_char('/')) { // In a subdirectory.
  93. Vector<String> ds = simplified_path.get_base_dir().split("/");
  94. for (int j = 0; j < ds.size(); j++) {
  95. if (!cd->subdirs.has(ds[j])) {
  96. return; // Subdirectory does not exist, do not bother creating.
  97. } else {
  98. cd = cd->subdirs[ds[j]];
  99. }
  100. }
  101. }
  102. cd->files.erase(simplified_path.get_file());
  103. files.erase(pmd5);
  104. }
  105. void PackedData::add_pack_source(PackSource *p_source) {
  106. if (p_source != nullptr) {
  107. sources.push_back(p_source);
  108. }
  109. }
  110. uint8_t *PackedData::get_file_hash(const String &p_path) {
  111. String simplified_path = p_path.simplify_path().trim_prefix("res://");
  112. PathMD5 pmd5(simplified_path.md5_buffer());
  113. HashMap<PathMD5, PackedFile, PathMD5>::Iterator E = files.find(pmd5);
  114. if (!E) {
  115. return nullptr;
  116. }
  117. return E->value.md5;
  118. }
  119. HashSet<String> PackedData::get_file_paths() const {
  120. HashSet<String> file_paths;
  121. _get_file_paths(root, root->name, file_paths);
  122. return file_paths;
  123. }
  124. void PackedData::_get_file_paths(PackedDir *p_dir, const String &p_parent_dir, HashSet<String> &r_paths) const {
  125. for (const String &E : p_dir->files) {
  126. r_paths.insert(p_parent_dir.path_join(E));
  127. }
  128. for (const KeyValue<String, PackedDir *> &E : p_dir->subdirs) {
  129. _get_file_paths(E.value, p_parent_dir.path_join(E.key), r_paths);
  130. }
  131. }
  132. void PackedData::clear() {
  133. files.clear();
  134. _free_packed_dirs(root);
  135. root = memnew(PackedDir);
  136. }
  137. PackedData::PackedData() {
  138. singleton = this;
  139. root = memnew(PackedDir);
  140. add_pack_source(memnew(PackedSourcePCK));
  141. }
  142. void PackedData::_free_packed_dirs(PackedDir *p_dir) {
  143. for (const KeyValue<String, PackedDir *> &E : p_dir->subdirs) {
  144. _free_packed_dirs(E.value);
  145. }
  146. memdelete(p_dir);
  147. }
  148. PackedData::~PackedData() {
  149. if (singleton == this) {
  150. singleton = nullptr;
  151. }
  152. for (int i = 0; i < sources.size(); i++) {
  153. memdelete(sources[i]);
  154. }
  155. _free_packed_dirs(root);
  156. }
  157. //////////////////////////////////////////////////////////////////
  158. bool PackedSourcePCK::try_open_pack(const String &p_path, bool p_replace_files, uint64_t p_offset) {
  159. Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ);
  160. if (f.is_null()) {
  161. return false;
  162. }
  163. bool pck_header_found = false;
  164. // Search for the header at the start offset - standalone PCK file.
  165. f->seek(p_offset);
  166. uint32_t magic = f->get_32();
  167. if (magic == PACK_HEADER_MAGIC) {
  168. pck_header_found = true;
  169. }
  170. // Search for the header in the executable "pck" section - self contained executable.
  171. if (!pck_header_found) {
  172. // Loading with offset feature not supported for self contained exe files.
  173. if (p_offset != 0) {
  174. ERR_FAIL_V_MSG(false, "Loading self-contained executable with offset not supported.");
  175. }
  176. int64_t pck_off = OS::get_singleton()->get_embedded_pck_offset();
  177. if (pck_off != 0) {
  178. // Search for the header, in case PCK start and section have different alignment.
  179. for (int i = 0; i < 8; i++) {
  180. f->seek(pck_off);
  181. magic = f->get_32();
  182. if (magic == PACK_HEADER_MAGIC) {
  183. #ifdef DEBUG_ENABLED
  184. print_verbose("PCK header found in executable pck section, loading from offset 0x" + String::num_int64(pck_off - 4, 16));
  185. #endif
  186. pck_header_found = true;
  187. break;
  188. }
  189. pck_off++;
  190. }
  191. }
  192. }
  193. // Search for the header at the end of file - self contained executable.
  194. if (!pck_header_found) {
  195. // Loading with offset feature not supported for self contained exe files.
  196. if (p_offset != 0) {
  197. ERR_FAIL_V_MSG(false, "Loading self-contained executable with offset not supported.");
  198. }
  199. f->seek_end();
  200. f->seek(f->get_position() - 4);
  201. magic = f->get_32();
  202. if (magic == PACK_HEADER_MAGIC) {
  203. f->seek(f->get_position() - 12);
  204. uint64_t ds = f->get_64();
  205. f->seek(f->get_position() - ds - 8);
  206. magic = f->get_32();
  207. if (magic == PACK_HEADER_MAGIC) {
  208. #ifdef DEBUG_ENABLED
  209. print_verbose("PCK header found at the end of executable, loading from offset 0x" + String::num_int64(f->get_position() - 4, 16));
  210. #endif
  211. pck_header_found = true;
  212. }
  213. }
  214. }
  215. if (!pck_header_found) {
  216. return false;
  217. }
  218. int64_t pck_start_pos = f->get_position() - 4;
  219. // Read header.
  220. uint32_t version = f->get_32();
  221. uint32_t ver_major = f->get_32();
  222. uint32_t ver_minor = f->get_32();
  223. uint32_t ver_patch = f->get_32(); // Not used for validation.
  224. ERR_FAIL_COND_V_MSG(version != PACK_FORMAT_VERSION_V3 && version != PACK_FORMAT_VERSION_V2, false, vformat("Pack version unsupported: %d.", version));
  225. ERR_FAIL_COND_V_MSG(ver_major > GODOT_VERSION_MAJOR || (ver_major == GODOT_VERSION_MAJOR && ver_minor > GODOT_VERSION_MINOR), false, vformat("Pack created with a newer version of the engine: %d.%d.%d.", ver_major, ver_minor, ver_patch));
  226. uint32_t pack_flags = f->get_32();
  227. bool enc_directory = (pack_flags & PACK_DIR_ENCRYPTED);
  228. bool rel_filebase = (pack_flags & PACK_REL_FILEBASE); // Note: Always enabled for V3.
  229. bool sparse_bundle = (pack_flags & PACK_SPARSE_BUNDLE);
  230. uint64_t file_base = f->get_64();
  231. if ((version == PACK_FORMAT_VERSION_V3) || (version == PACK_FORMAT_VERSION_V2 && rel_filebase)) {
  232. file_base += pck_start_pos;
  233. }
  234. if (version == PACK_FORMAT_VERSION_V3) {
  235. // V3: Read directory offset and skip reserved part of the header.
  236. uint64_t dir_offset = f->get_64() + pck_start_pos;
  237. f->seek(dir_offset);
  238. } else if (version == PACK_FORMAT_VERSION_V2) {
  239. // V2: Directory directly after the header.
  240. for (int i = 0; i < 16; i++) {
  241. f->get_32(); // Reserved.
  242. }
  243. }
  244. // Read directory.
  245. int file_count = f->get_32();
  246. if (enc_directory) {
  247. Ref<FileAccessEncrypted> fae;
  248. fae.instantiate();
  249. ERR_FAIL_COND_V_MSG(fae.is_null(), false, "Can't open encrypted pack directory.");
  250. Vector<uint8_t> key;
  251. key.resize(32);
  252. for (int i = 0; i < key.size(); i++) {
  253. key.write[i] = script_encryption_key[i];
  254. }
  255. Error err = fae->open_and_parse(f, key, FileAccessEncrypted::MODE_READ, false);
  256. ERR_FAIL_COND_V_MSG(err, false, "Can't open encrypted pack directory.");
  257. f = fae;
  258. }
  259. for (int i = 0; i < file_count; i++) {
  260. uint32_t sl = f->get_32();
  261. CharString cs;
  262. cs.resize_uninitialized(sl + 1);
  263. f->get_buffer((uint8_t *)cs.ptr(), sl);
  264. cs[sl] = 0;
  265. String path = String::utf8(cs.ptr(), sl);
  266. uint64_t ofs = f->get_64();
  267. uint64_t size = f->get_64();
  268. uint8_t md5[16];
  269. f->get_buffer(md5, 16);
  270. uint32_t flags = f->get_32();
  271. if (flags & PACK_FILE_REMOVAL) { // The file was removed.
  272. PackedData::get_singleton()->remove_path(path);
  273. } else {
  274. PackedData::get_singleton()->add_path(p_path, path, file_base + ofs, size, md5, this, p_replace_files, (flags & PACK_FILE_ENCRYPTED), sparse_bundle);
  275. }
  276. }
  277. return true;
  278. }
  279. Ref<FileAccess> PackedSourcePCK::get_file(const String &p_path, PackedData::PackedFile *p_file) {
  280. return memnew(FileAccessPack(p_path, *p_file));
  281. }
  282. //////////////////////////////////////////////////////////////////
  283. bool PackedSourceDirectory::try_open_pack(const String &p_path, bool p_replace_files, uint64_t p_offset) {
  284. // Load with offset feature only supported for PCK files.
  285. ERR_FAIL_COND_V_MSG(p_offset != 0, false, "Invalid PCK data. Note that loading files with a non-zero offset isn't supported with directories.");
  286. if (p_path != "res://") {
  287. return false;
  288. }
  289. add_directory(p_path, p_replace_files);
  290. return true;
  291. }
  292. Ref<FileAccess> PackedSourceDirectory::get_file(const String &p_path, PackedData::PackedFile *p_file) {
  293. Ref<FileAccess> ret = FileAccess::create_for_path(p_path);
  294. ret->reopen(p_path, FileAccess::READ);
  295. return ret;
  296. }
  297. void PackedSourceDirectory::add_directory(const String &p_path, bool p_replace_files) {
  298. Ref<DirAccess> da = DirAccess::open(p_path);
  299. if (da.is_null()) {
  300. return;
  301. }
  302. da->set_include_hidden(true);
  303. for (const String &file_name : da->get_files()) {
  304. String file_path = p_path.path_join(file_name);
  305. uint8_t md5[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
  306. PackedData::get_singleton()->add_path(p_path, file_path, 0, 0, md5, this, p_replace_files, false, false);
  307. }
  308. for (const String &sub_dir_name : da->get_directories()) {
  309. String sub_dir_path = p_path.path_join(sub_dir_name);
  310. add_directory(sub_dir_path, p_replace_files);
  311. }
  312. }
  313. //////////////////////////////////////////////////////////////////
  314. Error FileAccessPack::open_internal(const String &p_path, int p_mode_flags) {
  315. ERR_PRINT("Can't open pack-referenced file.");
  316. return ERR_UNAVAILABLE;
  317. }
  318. bool FileAccessPack::is_open() const {
  319. if (f.is_valid()) {
  320. return f->is_open();
  321. } else {
  322. return false;
  323. }
  324. }
  325. void FileAccessPack::seek(uint64_t p_position) {
  326. ERR_FAIL_COND_MSG(f.is_null(), "File must be opened before use.");
  327. if (p_position > pf.size) {
  328. eof = true;
  329. } else {
  330. eof = false;
  331. }
  332. f->seek(off + p_position);
  333. pos = p_position;
  334. }
  335. void FileAccessPack::seek_end(int64_t p_position) {
  336. seek(pf.size + p_position);
  337. }
  338. uint64_t FileAccessPack::get_position() const {
  339. return pos;
  340. }
  341. uint64_t FileAccessPack::get_length() const {
  342. return pf.size;
  343. }
  344. bool FileAccessPack::eof_reached() const {
  345. return eof;
  346. }
  347. uint64_t FileAccessPack::get_buffer(uint8_t *p_dst, uint64_t p_length) const {
  348. ERR_FAIL_COND_V_MSG(f.is_null(), -1, "File must be opened before use.");
  349. ERR_FAIL_COND_V(!p_dst && p_length > 0, -1);
  350. if (eof) {
  351. return 0;
  352. }
  353. int64_t to_read = p_length;
  354. if (to_read + pos > pf.size) {
  355. eof = true;
  356. to_read = (int64_t)pf.size - (int64_t)pos;
  357. }
  358. pos += to_read;
  359. if (to_read <= 0) {
  360. return 0;
  361. }
  362. f->get_buffer(p_dst, to_read);
  363. return to_read;
  364. }
  365. void FileAccessPack::set_big_endian(bool p_big_endian) {
  366. ERR_FAIL_COND_MSG(f.is_null(), "File must be opened before use.");
  367. FileAccess::set_big_endian(p_big_endian);
  368. f->set_big_endian(p_big_endian);
  369. }
  370. Error FileAccessPack::get_error() const {
  371. if (eof) {
  372. return ERR_FILE_EOF;
  373. }
  374. return OK;
  375. }
  376. void FileAccessPack::flush() {
  377. ERR_FAIL();
  378. }
  379. bool FileAccessPack::store_buffer(const uint8_t *p_src, uint64_t p_length) {
  380. ERR_FAIL_V(false);
  381. }
  382. bool FileAccessPack::file_exists(const String &p_name) {
  383. return false;
  384. }
  385. void FileAccessPack::close() {
  386. f = Ref<FileAccess>();
  387. }
  388. FileAccessPack::FileAccessPack(const String &p_path, const PackedData::PackedFile &p_file) {
  389. pf = p_file;
  390. if (pf.bundle) {
  391. String simplified_path = p_path.simplify_path();
  392. f = FileAccess::open(simplified_path, FileAccess::READ | FileAccess::SKIP_PACK);
  393. off = 0; // For the sparse pack offset is always zero.
  394. } else {
  395. f = FileAccess::open(pf.pack, FileAccess::READ);
  396. f->seek(pf.offset);
  397. off = pf.offset;
  398. }
  399. ERR_FAIL_COND_MSG(f.is_null(), vformat("Can't open pack-referenced file '%s'.", String(pf.pack)));
  400. if (pf.encrypted) {
  401. Ref<FileAccessEncrypted> fae;
  402. fae.instantiate();
  403. ERR_FAIL_COND_MSG(fae.is_null(), vformat("Can't open encrypted pack-referenced file '%s'.", String(pf.pack)));
  404. Vector<uint8_t> key;
  405. key.resize(32);
  406. for (int i = 0; i < key.size(); i++) {
  407. key.write[i] = script_encryption_key[i];
  408. }
  409. Error err = fae->open_and_parse(f, key, FileAccessEncrypted::MODE_READ, false);
  410. ERR_FAIL_COND_MSG(err, vformat("Can't open encrypted pack-referenced file '%s'.", String(pf.pack)));
  411. f = fae;
  412. off = 0;
  413. }
  414. pos = 0;
  415. eof = false;
  416. }
  417. //////////////////////////////////////////////////////////////////////////////////
  418. // DIR ACCESS
  419. //////////////////////////////////////////////////////////////////////////////////
  420. Error DirAccessPack::list_dir_begin() {
  421. list_dirs.clear();
  422. list_files.clear();
  423. for (const KeyValue<String, PackedData::PackedDir *> &E : current->subdirs) {
  424. list_dirs.push_back(E.key);
  425. }
  426. for (const String &E : current->files) {
  427. list_files.push_back(E);
  428. }
  429. return OK;
  430. }
  431. String DirAccessPack::get_next() {
  432. if (list_dirs.size()) {
  433. cdir = true;
  434. String d = list_dirs.front()->get();
  435. list_dirs.pop_front();
  436. return d;
  437. } else if (list_files.size()) {
  438. cdir = false;
  439. String f = list_files.front()->get();
  440. list_files.pop_front();
  441. return f;
  442. } else {
  443. return String();
  444. }
  445. }
  446. bool DirAccessPack::current_is_dir() const {
  447. return cdir;
  448. }
  449. bool DirAccessPack::current_is_hidden() const {
  450. return false;
  451. }
  452. void DirAccessPack::list_dir_end() {
  453. list_dirs.clear();
  454. list_files.clear();
  455. }
  456. int DirAccessPack::get_drive_count() {
  457. return 0;
  458. }
  459. String DirAccessPack::get_drive(int p_drive) {
  460. return "";
  461. }
  462. PackedData::PackedDir *DirAccessPack::_find_dir(const String &p_dir) {
  463. String nd = p_dir.replace_char('\\', '/');
  464. // Special handling since simplify_path() will forbid it
  465. if (p_dir == "..") {
  466. return current->parent;
  467. }
  468. bool absolute = false;
  469. if (nd.begins_with("res://")) {
  470. nd = nd.replace_first("res://", "");
  471. absolute = true;
  472. }
  473. nd = nd.simplify_path();
  474. if (nd.is_empty()) {
  475. nd = ".";
  476. }
  477. if (nd.begins_with("/")) {
  478. nd = nd.replace_first("/", "");
  479. absolute = true;
  480. }
  481. Vector<String> paths = nd.split("/");
  482. PackedData::PackedDir *pd;
  483. if (absolute) {
  484. pd = PackedData::get_singleton()->root;
  485. } else {
  486. pd = current;
  487. }
  488. for (int i = 0; i < paths.size(); i++) {
  489. const String &p = paths[i];
  490. if (p == ".") {
  491. continue;
  492. } else if (p == "..") {
  493. if (pd->parent) {
  494. pd = pd->parent;
  495. }
  496. } else if (pd->subdirs.has(p)) {
  497. pd = pd->subdirs[p];
  498. } else {
  499. return nullptr;
  500. }
  501. }
  502. return pd;
  503. }
  504. Error DirAccessPack::change_dir(String p_dir) {
  505. PackedData::PackedDir *pd = _find_dir(p_dir);
  506. if (pd) {
  507. current = pd;
  508. return OK;
  509. } else {
  510. return ERR_INVALID_PARAMETER;
  511. }
  512. }
  513. String DirAccessPack::get_current_dir(bool p_include_drive) const {
  514. PackedData::PackedDir *pd = current;
  515. String p = current->name;
  516. while (pd->parent) {
  517. pd = pd->parent;
  518. p = pd->name.path_join(p);
  519. }
  520. return "res://" + p;
  521. }
  522. bool DirAccessPack::file_exists(String p_file) {
  523. PackedData::PackedDir *pd = _find_dir(p_file.get_base_dir());
  524. if (!pd) {
  525. return false;
  526. }
  527. return pd->files.has(p_file.get_file());
  528. }
  529. bool DirAccessPack::dir_exists(String p_dir) {
  530. return _find_dir(p_dir) != nullptr;
  531. }
  532. Error DirAccessPack::make_dir(String p_dir) {
  533. return ERR_UNAVAILABLE;
  534. }
  535. Error DirAccessPack::rename(String p_from, String p_to) {
  536. return ERR_UNAVAILABLE;
  537. }
  538. Error DirAccessPack::remove(String p_name) {
  539. return ERR_UNAVAILABLE;
  540. }
  541. uint64_t DirAccessPack::get_space_left() {
  542. return 0;
  543. }
  544. String DirAccessPack::get_filesystem_type() const {
  545. return "PCK";
  546. }
  547. DirAccessPack::DirAccessPack() {
  548. current = PackedData::get_singleton()->root;
  549. }