Skip to content

Commit 6cfd99f

Browse files
committed
xrCore: remove some xr_strlwr for properly use of case-sensitive filenames
1 parent 9971980 commit 6cfd99f

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

src/xrCore/LocatorAPI.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -860,8 +860,7 @@ void CLocatorAPI::_initialize(u32 flags, pcstr target_folder, pcstr fs_name)
860860
_GetItem(temp, 5, capt, _delimiter);
861861
xr_strlwr(id);
862862

863-
xr_strlwr(root);
864-
lp_add = cnt >= 4 ? xr_strlwr(add) : 0;
863+
lp_add = cnt >= 4 ? add : 0;
865864
lp_def = cnt >= 5 ? def : 0;
866865
lp_capt = cnt >= 6 ? capt : 0;
867866

@@ -1465,7 +1464,6 @@ IWriter* CLocatorAPI::w_open(pcstr path, pcstr _fname)
14651464
{
14661465
string_path fname;
14671466
xr_strcpy(fname, _fname);
1468-
xr_strlwr(fname); //,".$");
14691467
if (path && path[0])
14701468
update_path(fname, path, fname);
14711469
CFileWriter* W = new CFileWriter(fname, false);
@@ -1480,7 +1478,6 @@ IWriter* CLocatorAPI::w_open_ex(pcstr path, pcstr _fname)
14801478
{
14811479
string_path fname;
14821480
xr_strcpy(fname, _fname);
1483-
xr_strlwr(fname); //,".$");
14841481
if (path && path[0])
14851482
update_path(fname, path, fname);
14861483
CFileWriter* W = new CFileWriter(fname, true);
@@ -1642,7 +1639,7 @@ void CLocatorAPI::file_rename(pcstr src, pcstr dest, bool overwrite)
16421639
xr_free(str);
16431640
m_files.erase(S);
16441641
// insert updated item
1645-
new_desc.name = xr_strlwr(xr_strdup(dest));
1642+
new_desc.name = xr_strdup(dest);
16461643
m_files.insert(new_desc);
16471644

16481645
// physically rename file

src/xrCore/LocatorAPI_defs.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ FS_File::FS_File(const xr_string& nm, const _FINDDATA_T& f) {}
3232
void FS_File::set(const xr_string& nm, long sz, time_t modif, unsigned attr)
3333
{
3434
name = nm;
35-
xr_strlwr(name);
3635
size = sz;
3736
time_write = modif;
3837
attrib = attr;
@@ -58,9 +57,9 @@ FS_Path::FS_Path(LPCSTR _Root, LPCSTR _Add, LPCSTR _DefExt, LPCSTR _FilterCaptio
5857
if (temp[0] && temp[xr_strlen(temp) - 1] != _DELIMITER)
5958
xr_strcat(temp, DELIMITER);
6059
m_Path = xr_strdup(temp);
61-
m_DefExt = _DefExt ? xr_strlwr(xr_strdup(_DefExt)) : 0;
60+
m_DefExt = _DefExt ? xr_strdup(_DefExt) : 0;
6261
m_FilterCaption = _FilterCaption ? xr_strlwr(xr_strdup(_FilterCaption)) : 0;
63-
m_Add = _Add ? xr_strlwr(xr_strdup(_Add)) : 0;
62+
m_Add = _Add ? xr_strdup(_Add) : 0;
6463
m_Root = _Root ? xr_strdup(_Root) : 0;
6564
m_Flags.assign(flags);
6665
#ifdef _EDITOR
@@ -83,7 +82,7 @@ void FS_Path::_set(LPCSTR add)
8382
// m_Add
8483
R_ASSERT(add);
8584
xr_free(m_Add);
86-
m_Add = xr_strlwr(xr_strdup(add));
85+
m_Add = xr_strdup(add);
8786

8887
// m_Path
8988
string_path temp;

src/xrCore/xr_ini.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,8 @@ void CInifile::Load(IReader* F, pcstr path, allow_include_func_t allow_include_f
457457
tmp_ptr = strchr(tmp_ptr, '\\');
458458
}
459459
#endif
460+
xr_strlwr(inc_name); // compensate removed xr_strlwr on path
461+
460462
string_path fn;
461463
strconcat(sizeof fn, fn, path, inc_name);
462464
const xr_string inc_path = EFS_Utils::ExtractFilePath(fn);
@@ -690,7 +692,9 @@ CInifile::Sect& CInifile::r_section(pcstr S) const
690692
xr_strcpy(section, sizeof section, S);
691693
xr_strlwr(section);
692694
auto I = std::lower_bound(DATA.cbegin(), DATA.cend(), section, sect_pred);
693-
if (!(I != DATA.cend() && xr_strcmp(*(*I)->Name, section) == 0))
695+
if (I == DATA.cend())
696+
xrDebug::Fatal(DEBUG_INFO, "Can't find section '%s'.", S);
697+
else if (xr_strcmp(*(*I)->Name, section))
694698
{
695699
// g_pStringContainer->verify();
696700

@@ -703,8 +707,7 @@ CInifile::Sect& CInifile::r_section(pcstr S) const
703707
// F->w_string ("shared strings:");
704708
// g_pStringContainer->dump(F);
705709
// FS.w_close (F);
706-
707-
xrDebug::Fatal(DEBUG_INFO, "Can't open section '%s'. Please attach [*.ini_log] file to your bug report", S);
710+
xrDebug::Fatal(DEBUG_INFO, "Can't open section '%s' (only '%s' avail). Please attach [*.ini_log] file to your bug report", section, *(*I)->Name);
708711
}
709712
return **I;
710713
}

0 commit comments

Comments
 (0)