Skip to content

Commit 6ae0bfc

Browse files
author
Swagtoy
committed
Fix deletePathFromFilename returning cutoff filename on Windows
1 parent bca4457 commit 6ae0bfc

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

irr/include/coreutil.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ inline io::path &getFileNameExtension(io::path &dest, const io::path &source)
6363
}
6464

6565
//! delete path from filename
66-
inline io::path &deletePathFromFilename(io::path &filename)
66+
inline io::path deletePathFromFilename(const io::path &filename)
6767
{
68+
io::path res;
6869
// delete path from filename
6970
const fschar_t *s = filename.c_str();
7071
const fschar_t *p = s + filename.size();
@@ -75,9 +76,9 @@ inline io::path &deletePathFromFilename(io::path &filename)
7576

7677
if (p != s) {
7778
++p;
78-
filename = p;
79+
res = p;
7980
}
80-
return filename;
81+
return res;
8182
}
8283

8384
//! trim paths

irr/src/CFileList.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ u32 CFileList::addItem(const io::path &fullPath, u32 offset, u32 size, bool isDi
8080

8181
entry.FullName = entry.Name;
8282

83-
core::deletePathFromFilename(entry.Name);
83+
entry.Name = core::deletePathFromFilename(entry.Name);
8484

8585
if (IgnorePaths)
8686
entry.FullName = entry.Name;

0 commit comments

Comments
 (0)