Skip to content

Commit a34f23c

Browse files
authored
fix(vpkpp): PackFile::getBakeOutputDir unable to recognize parent directory of original file with backslash
1 parent c71a53a commit a34f23c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/vpkpp/PackFile.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -637,18 +637,20 @@ std::vector<std::string> PackFile::verifyEntryChecksumsUsingCRC32() const {
637637

638638
std::string PackFile::getBakeOutputDir(const std::string& outputDir) const {
639639
std::string out = outputDir;
640-
if (!out.empty()) {
641-
string::normalizeSlashes(out, false);
642-
} else {
640+
if (out.empty()) {
643641
out = this->fullFilePath;
644642
auto lastSlash = out.rfind('/');
645-
string::normalizeSlashes(out, false);
643+
auto lastBackSlash = out.rfind('\\');
644+
if (lastSlash == std::string::npos || (lastBackSlash != std::string::npos && lastBackSlash > lastSlash)) {
645+
lastSlash = lastBackSlash;
646+
}
646647
if (lastSlash != std::string::npos) {
647648
out = this->getFilepath().substr(0, lastSlash);
648649
} else {
649650
out = ".";
650651
}
651652
}
653+
string::normalizeSlashes(out, false);
652654
return out;
653655
}
654656

0 commit comments

Comments
 (0)