Skip to content

Commit

Permalink
xrCore: fix archive patches at registry
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleivg committed Aug 19, 2018
1 parent 1281255 commit d4525f7
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 10 deletions.
14 changes: 11 additions & 3 deletions src/Common/PlatformLinux.inl
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,22 @@ inline void _splitpath (
char* fname, // Filename : Output
char* ext // Extension : Output
){
char *tmp = NULL;
tmp = realpath(path, NULL);

if(drive)
strcpy(drive, "");

if(dir)
strcpy(dir, dirname(path));
if(dir) {
strcpy(dir, dirname(tmp));
if (dir[0] && dir[strlen(dir) - 1] != '/')
strcat(dir, "/");
}

if(fname)
strcpy(fname, basename(path));
strcpy(fname, basename(tmp));

free(tmp);
}

#include <iostream>
Expand Down
16 changes: 10 additions & 6 deletions src/xrCore/LocatorAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,9 @@ const CLocatorAPI::file* CLocatorAPI::RegisterExternal(pcstr name)
const CLocatorAPI::file* CLocatorAPI::Register(
pcstr name, u32 vfs, u32 crc, u32 ptr, u32 size_real, u32 size_compressed, u32 modif)
{
Msg("Register[%d] [%s]",vfs,name);
//Msg("Register[%d] [%s]",vfs,name);
string256 temp_file_name;
xr_strcpy(temp_file_name, sizeof temp_file_name, name);
xr_strlwr(temp_file_name);

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

strconcat(sizeof full, full, fs_entry_point, name);

#if defined(LINUX)
char *tmp_ptr = strchr(full, '\\');
while (tmp_ptr) {
*tmp_ptr = '/';
tmp_ptr = strchr(tmp_ptr, '\\');
}
#endif
Register(full, A.vfs_idx, crc, ptr, size_real, size_compr, 0);
}
hdr->close();
Expand Down Expand Up @@ -531,7 +536,7 @@ void CLocatorAPI::ProcessOne(pcstr path, const _finddata_t& entry)
return;
if (0 == xr_strcmp(entry.name, ".."))
return;
xr_strcat(N, "\\");
xr_strcat(N, DELIMITER);
Register(N, 0xffffffff, 0, 0, entry.size, entry.size, (u32)entry.time_write);
Recurse(N);
}
Expand Down Expand Up @@ -1254,7 +1259,7 @@ void CLocatorAPI::file_from_archive(IReader*& R, pcstr fname, const file& desc)

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

string512 temp;
string1024 temp;
xr_sprintf(temp, sizeof temp, "%s:%s", *A.path, fname);

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

// correct path
xr_strcpy(fname, _fname);
xr_strlwr(fname);
if (path && path[0])
update_path(fname, path, fname);

Expand Down
2 changes: 1 addition & 1 deletion src/xrCore/LocatorAPI_defs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ LPCSTR FS_Path::_update(string_path& dest, LPCSTR src) const
string_path temp;
xr_strcpy(temp, sizeof(temp), src);
strconcat(sizeof(dest), dest, m_Path, temp);
return xr_strlwr(dest);
return dest;
}
/*
void FS_Path::_update(xr_string& dest, LPCSTR src)const
Expand Down
7 changes: 7 additions & 0 deletions src/xrCore/xr_ini.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,13 @@ void CInifile::Load(IReader* F, pcstr path, allow_include_func_t allow_include_f
R_ASSERT(path && path[0]);
if (_GetItem(str, 1, inc_name, '"'))
{
#if defined(LINUX)
char *tmp_ptr = strchr(inc_name, '\\');
while (tmp_ptr) {
*tmp_ptr = '/';
tmp_ptr = strchr(tmp_ptr, '\\');
}
#endif
string_path fn;
strconcat(sizeof fn, fn, path, inc_name);
const xr_string inc_path = EFS_Utils::ExtractFilePath(fn);
Expand Down

0 comments on commit d4525f7

Please sign in to comment.