diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp index bb942b54d76..79aa39521fb 100644 --- a/core/io/file_access_pack.cpp +++ b/core/io/file_access_pack.cpp @@ -440,13 +440,12 @@ Error DirAccessPack::change_dir(String p_dir) { String DirAccessPack::get_current_dir() { - String p; PackedData::PackedDir *pd = current; - while (pd->parent) { + String p = current->name; - if (pd != current) - p = "/" + p; - p = p + pd->name; + while (pd->parent) { + pd = pd->parent; + p = pd->name + "/" + p; } return "res://" + p;