Skip to content

Commit

Permalink
xrCore: remove some xr_strlwr for properly use of case-sensitive file…
Browse files Browse the repository at this point in the history
…names
  • Loading branch information
eagleivg committed Aug 22, 2018
1 parent 9971980 commit 6cfd99f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
7 changes: 2 additions & 5 deletions src/xrCore/LocatorAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -860,8 +860,7 @@ void CLocatorAPI::_initialize(u32 flags, pcstr target_folder, pcstr fs_name)
_GetItem(temp, 5, capt, _delimiter);
xr_strlwr(id);

xr_strlwr(root);
lp_add = cnt >= 4 ? xr_strlwr(add) : 0;
lp_add = cnt >= 4 ? add : 0;
lp_def = cnt >= 5 ? def : 0;
lp_capt = cnt >= 6 ? capt : 0;

Expand Down Expand Up @@ -1465,7 +1464,6 @@ IWriter* CLocatorAPI::w_open(pcstr path, pcstr _fname)
{
string_path fname;
xr_strcpy(fname, _fname);
xr_strlwr(fname); //,".$");
if (path && path[0])
update_path(fname, path, fname);
CFileWriter* W = new CFileWriter(fname, false);
Expand All @@ -1480,7 +1478,6 @@ IWriter* CLocatorAPI::w_open_ex(pcstr path, pcstr _fname)
{
string_path fname;
xr_strcpy(fname, _fname);
xr_strlwr(fname); //,".$");
if (path && path[0])
update_path(fname, path, fname);
CFileWriter* W = new CFileWriter(fname, true);
Expand Down Expand Up @@ -1642,7 +1639,7 @@ void CLocatorAPI::file_rename(pcstr src, pcstr dest, bool overwrite)
xr_free(str);
m_files.erase(S);
// insert updated item
new_desc.name = xr_strlwr(xr_strdup(dest));
new_desc.name = xr_strdup(dest);
m_files.insert(new_desc);

// physically rename file
Expand Down
7 changes: 3 additions & 4 deletions src/xrCore/LocatorAPI_defs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ FS_File::FS_File(const xr_string& nm, const _FINDDATA_T& f) {}
void FS_File::set(const xr_string& nm, long sz, time_t modif, unsigned attr)
{
name = nm;
xr_strlwr(name);
size = sz;
time_write = modif;
attrib = attr;
Expand All @@ -58,9 +57,9 @@ FS_Path::FS_Path(LPCSTR _Root, LPCSTR _Add, LPCSTR _DefExt, LPCSTR _FilterCaptio
if (temp[0] && temp[xr_strlen(temp) - 1] != _DELIMITER)
xr_strcat(temp, DELIMITER);
m_Path = xr_strdup(temp);
m_DefExt = _DefExt ? xr_strlwr(xr_strdup(_DefExt)) : 0;
m_DefExt = _DefExt ? xr_strdup(_DefExt) : 0;
m_FilterCaption = _FilterCaption ? xr_strlwr(xr_strdup(_FilterCaption)) : 0;
m_Add = _Add ? xr_strlwr(xr_strdup(_Add)) : 0;
m_Add = _Add ? xr_strdup(_Add) : 0;
m_Root = _Root ? xr_strdup(_Root) : 0;
m_Flags.assign(flags);
#ifdef _EDITOR
Expand All @@ -83,7 +82,7 @@ void FS_Path::_set(LPCSTR add)
// m_Add
R_ASSERT(add);
xr_free(m_Add);
m_Add = xr_strlwr(xr_strdup(add));
m_Add = xr_strdup(add);

// m_Path
string_path temp;
Expand Down
9 changes: 6 additions & 3 deletions src/xrCore/xr_ini.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,8 @@ void CInifile::Load(IReader* F, pcstr path, allow_include_func_t allow_include_f
tmp_ptr = strchr(tmp_ptr, '\\');
}
#endif
xr_strlwr(inc_name); // compensate removed xr_strlwr on path

string_path fn;
strconcat(sizeof fn, fn, path, inc_name);
const xr_string inc_path = EFS_Utils::ExtractFilePath(fn);
Expand Down Expand Up @@ -690,7 +692,9 @@ CInifile::Sect& CInifile::r_section(pcstr S) const
xr_strcpy(section, sizeof section, S);
xr_strlwr(section);
auto I = std::lower_bound(DATA.cbegin(), DATA.cend(), section, sect_pred);
if (!(I != DATA.cend() && xr_strcmp(*(*I)->Name, section) == 0))
if (I == DATA.cend())
xrDebug::Fatal(DEBUG_INFO, "Can't find section '%s'.", S);
else if (xr_strcmp(*(*I)->Name, section))
{
// g_pStringContainer->verify();

Expand All @@ -703,8 +707,7 @@ CInifile::Sect& CInifile::r_section(pcstr S) const
// F->w_string ("shared strings:");
// g_pStringContainer->dump(F);
// FS.w_close (F);

xrDebug::Fatal(DEBUG_INFO, "Can't open section '%s'. Please attach [*.ini_log] file to your bug report", S);
xrDebug::Fatal(DEBUG_INFO, "Can't open section '%s' (only '%s' avail). Please attach [*.ini_log] file to your bug report", section, *(*I)->Name);
}
return **I;
}
Expand Down

0 comments on commit 6cfd99f

Please sign in to comment.