Skip to content

Commit 3b84eef

Browse files
committed
Normalize paths before inserting them in the virtual filesystem
If we don't do this, then memory files passed using patchparams to asar_patch_ex won't be found unless they are equal to their normalized form. E.g. if you pass a memory file with a path "Test.asm", and a patch has "incsrc Test.asm", asar will check if "test.asm" exists in the vfs and it won't find it, leading to an error.
1 parent 3aee781 commit 3b84eef

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/asar/virtualfile.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,9 @@ virtual_filesystem::virtual_file_type virtual_filesystem::get_file_type_from_pat
259259

260260
void virtual_filesystem::add_memory_file(const char* name, const void* buffer, size_t length) {
261261
memory_buffer mem_buf = { buffer, length };
262-
m_memory_files.remove(name);
263-
m_memory_files.create(name) = mem_buf;
262+
string normalized_path = normalize_path(name);
263+
m_memory_files.remove(normalized_path);
264+
m_memory_files.create(normalized_path) = mem_buf;
264265

265266
}
266267

0 commit comments

Comments
 (0)