Skip to content

Commit

Permalink
Fix for texture paths with backslash at front
Browse files Browse the repository at this point in the history
  • Loading branch information
ousnius committed Aug 16, 2015
1 parent f034044 commit f0eb134
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions NifFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ void NifFile::TrimTexturePaths() {
for (int i = 0; i < 9; i++) {
if (GetTextureForShape(s, tFile, i) && !tFile.empty()) {
tFile = regex_replace(tFile, regex("/+|\\\\+"), "\\"); // Replace multiple slashes or forward slashes with one backslash
tFile = regex_replace(tFile, regex("^\\\\+", regex_constants::icase), ""); // Remove all backslashes from the front
tFile = regex_replace(tFile, regex(".*?Data\\\\", regex_constants::icase), ""); // Remove everything before and including the data path root
tFile = regex_replace(tFile, regex("^(?!^textures\\\\)", regex_constants::icase), "textures\\"); // Add textures root path if not existing
SetTextureForShape(s, tFile, i);
Expand Down

0 comments on commit f0eb134

Please sign in to comment.