Skip to content

Commit d4525f7

Browse files
committed
xrCore: fix archive patches at registry
1 parent 1281255 commit d4525f7

File tree

4 files changed

+29
-10
lines changed

4 files changed

+29
-10
lines changed

src/Common/PlatformLinux.inl

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,22 @@ inline void _splitpath (
9595
char* fname, // Filename : Output
9696
char* ext // Extension : Output
9797
){
98+
char *tmp = NULL;
99+
tmp = realpath(path, NULL);
100+
98101
if(drive)
99102
strcpy(drive, "");
100103

101-
if(dir)
102-
strcpy(dir, dirname(path));
104+
if(dir) {
105+
strcpy(dir, dirname(tmp));
106+
if (dir[0] && dir[strlen(dir) - 1] != '/')
107+
strcat(dir, "/");
108+
}
103109

104110
if(fname)
105-
strcpy(fname, basename(path));
111+
strcpy(fname, basename(tmp));
112+
113+
free(tmp);
106114
}
107115

108116
#include <iostream>

src/xrCore/LocatorAPI.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,9 @@ const CLocatorAPI::file* CLocatorAPI::RegisterExternal(pcstr name)
193193
const CLocatorAPI::file* CLocatorAPI::Register(
194194
pcstr name, u32 vfs, u32 crc, u32 ptr, u32 size_real, u32 size_compressed, u32 modif)
195195
{
196-
Msg("Register[%d] [%s]",vfs,name);
196+
//Msg("Register[%d] [%s]",vfs,name);
197197
string256 temp_file_name;
198198
xr_strcpy(temp_file_name, sizeof temp_file_name, name);
199-
xr_strlwr(temp_file_name);
200199

201200
// Register file
202201
file desc;
@@ -403,7 +402,13 @@ void CLocatorAPI::LoadArchive(archive& A, pcstr entrypoint)
403402
buffer += sizeof ptr;
404403

405404
strconcat(sizeof full, full, fs_entry_point, name);
406-
405+
#if defined(LINUX)
406+
char *tmp_ptr = strchr(full, '\\');
407+
while (tmp_ptr) {
408+
*tmp_ptr = '/';
409+
tmp_ptr = strchr(tmp_ptr, '\\');
410+
}
411+
#endif
407412
Register(full, A.vfs_idx, crc, ptr, size_real, size_compr, 0);
408413
}
409414
hdr->close();
@@ -531,7 +536,7 @@ void CLocatorAPI::ProcessOne(pcstr path, const _finddata_t& entry)
531536
return;
532537
if (0 == xr_strcmp(entry.name, ".."))
533538
return;
534-
xr_strcat(N, "\\");
539+
xr_strcat(N, DELIMITER);
535540
Register(N, 0xffffffff, 0, 0, entry.size, entry.size, (u32)entry.time_write);
536541
Recurse(N);
537542
}
@@ -1254,7 +1259,7 @@ void CLocatorAPI::file_from_archive(IReader*& R, pcstr fname, const file& desc)
12541259

12551260
VERIFY3(ptr, "cannot create file mapping on file", fname);
12561261

1257-
string512 temp;
1262+
string1024 temp;
12581263
xr_sprintf(temp, sizeof temp, "%s:%s", *A.path, fname);
12591264

12601265
#ifdef FS_DEBUG
@@ -1388,7 +1393,6 @@ bool CLocatorAPI::check_for_file(pcstr path, pcstr _fname, string_path& fname, c
13881393

13891394
// correct path
13901395
xr_strcpy(fname, _fname);
1391-
xr_strlwr(fname);
13921396
if (path && path[0])
13931397
update_path(fname, path, fname);
13941398

src/xrCore/LocatorAPI_defs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ LPCSTR FS_Path::_update(string_path& dest, LPCSTR src) const
118118
string_path temp;
119119
xr_strcpy(temp, sizeof(temp), src);
120120
strconcat(sizeof(dest), dest, m_Path, temp);
121-
return xr_strlwr(dest);
121+
return dest;
122122
}
123123
/*
124124
void FS_Path::_update(xr_string& dest, LPCSTR src)const

src/xrCore/xr_ini.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,13 @@ void CInifile::Load(IReader* F, pcstr path, allow_include_func_t allow_include_f
450450
R_ASSERT(path && path[0]);
451451
if (_GetItem(str, 1, inc_name, '"'))
452452
{
453+
#if defined(LINUX)
454+
char *tmp_ptr = strchr(inc_name, '\\');
455+
while (tmp_ptr) {
456+
*tmp_ptr = '/';
457+
tmp_ptr = strchr(tmp_ptr, '\\');
458+
}
459+
#endif
453460
string_path fn;
454461
strconcat(sizeof fn, fn, path, inc_name);
455462
const xr_string inc_path = EFS_Utils::ExtractFilePath(fn);

0 commit comments

Comments
 (0)