mirror of
https://github.com/wiiu-env/ContentRedirectionModule.git
synced 2024-09-28 19:18:41 +02:00
Revert "Add support for FS_LAYER_TYPE_SAVE_REPLACE_IGNORE_VOL_SAVE_COMMON"
This reverts commit 71406e2044
.
This commit is contained in:
parent
0d5bf8c78f
commit
a2c8863cbe
@ -670,15 +670,7 @@ bool FSWrapper::IsFileModeAllowed(const char *mode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool FSWrapper::IsPathToReplace(const std::string_view &path) {
|
bool FSWrapper::IsPathToReplace(const std::string_view &path) {
|
||||||
if (!path.starts_with(pPathToReplace)) {
|
return path.starts_with(pPathToReplace);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (std::ranges::any_of(pIgnorePaths.cbegin(), pIgnorePaths.cend(), [&path](auto &ignorePath) { return path.starts_with(ignorePath); })) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string FSWrapper::GetNewPath(const std::string_view &path) {
|
std::string FSWrapper::GetNewPath(const std::string_view &path) {
|
||||||
|
@ -10,20 +10,16 @@
|
|||||||
|
|
||||||
class FSWrapper : public IFSWrapper {
|
class FSWrapper : public IFSWrapper {
|
||||||
public:
|
public:
|
||||||
FSWrapper(const std::string &name, const std::string &pathToReplace, const std::string &replacePathWith, bool fallbackOnError, bool isWriteable, std::vector<std::string> ignorePaths = {}) {
|
FSWrapper(const std::string &name, const std::string &pathToReplace, const std::string &replacePathWith, bool fallbackOnError, bool isWriteable) {
|
||||||
this->pName = name;
|
this->pName = name;
|
||||||
this->pPathToReplace = pathToReplace;
|
this->pPathToReplace = pathToReplace;
|
||||||
this->pReplacePathWith = replacePathWith;
|
this->pReplacePathWith = replacePathWith;
|
||||||
this->pFallbackOnError = fallbackOnError;
|
this->pFallbackOnError = fallbackOnError;
|
||||||
this->pIsWriteable = isWriteable;
|
this->pIsWriteable = isWriteable;
|
||||||
this->pCheckIfDeleted = fallbackOnError;
|
this->pCheckIfDeleted = fallbackOnError;
|
||||||
this->pIgnorePaths = std::move(ignorePaths);
|
|
||||||
|
|
||||||
std::replace(pPathToReplace.begin(), pPathToReplace.end(), '\\', '/');
|
std::replace(pPathToReplace.begin(), pPathToReplace.end(), '\\', '/');
|
||||||
std::replace(pReplacePathWith.begin(), pReplacePathWith.end(), '\\', '/');
|
std::replace(pReplacePathWith.begin(), pReplacePathWith.end(), '\\', '/');
|
||||||
for (auto &ignorePath : pIgnorePaths) {
|
|
||||||
std::replace(ignorePath.begin(), ignorePath.end(), '\\', '/');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
~FSWrapper() override {
|
~FSWrapper() override {
|
||||||
{
|
{
|
||||||
@ -133,7 +129,6 @@ protected:
|
|||||||
private:
|
private:
|
||||||
std::string pPathToReplace;
|
std::string pPathToReplace;
|
||||||
std::string pReplacePathWith;
|
std::string pReplacePathWith;
|
||||||
std::vector<std::string> pIgnorePaths;
|
|
||||||
bool pIsWriteable = false;
|
bool pIsWriteable = false;
|
||||||
std::mutex openFilesMutex;
|
std::mutex openFilesMutex;
|
||||||
std::mutex openDirsMutex;
|
std::mutex openDirsMutex;
|
||||||
|
@ -115,10 +115,6 @@ ContentRedirectionApiErrorType CRAddFSLayer(CRLayerHandle *handle, const char *l
|
|||||||
} else if (layerType == FS_LAYER_TYPE_SAVE_REPLACE) {
|
} else if (layerType == FS_LAYER_TYPE_SAVE_REPLACE) {
|
||||||
DEBUG_FUNCTION_LINE_INFO("Redirecting \"/vol/save\" to \"%s\", mode: \"replace\"", replacementDir);
|
DEBUG_FUNCTION_LINE_INFO("Redirecting \"/vol/save\" to \"%s\", mode: \"replace\"", replacementDir);
|
||||||
ptr = make_unique_nothrow<FSWrapper>(layerName, "/vol/save", replacementDir, false, true);
|
ptr = make_unique_nothrow<FSWrapper>(layerName, "/vol/save", replacementDir, false, true);
|
||||||
} else if (layerType == FS_LAYER_TYPE_SAVE_REPLACE_IGNORE_VOL_SAVE_COMMON) {
|
|
||||||
DEBUG_FUNCTION_LINE_INFO("Redirecting \"/vol/save\" to \"%s\", mode: \"replace\", ignore: (\"/vol/save/common\")", replacementDir);
|
|
||||||
std::vector<std::string> ignorePaths({"/vol/save/common"});
|
|
||||||
ptr = make_unique_nothrow<FSWrapper>(layerName, "/vol/save", replacementDir, false, true, ignorePaths);
|
|
||||||
} else {
|
} else {
|
||||||
DEBUG_FUNCTION_LINE_ERR("CONTENT_REDIRECTION_API_ERROR_UNKNOWN_LAYER_DIR_TYPE: %s %s %d", layerName, replacementDir, layerType);
|
DEBUG_FUNCTION_LINE_ERR("CONTENT_REDIRECTION_API_ERROR_UNKNOWN_LAYER_DIR_TYPE: %s %s %d", layerName, replacementDir, layerType);
|
||||||
return CONTENT_REDIRECTION_API_ERROR_UNKNOWN_FS_LAYER_TYPE;
|
return CONTENT_REDIRECTION_API_ERROR_UNKNOWN_FS_LAYER_TYPE;
|
||||||
|
Loading…
Reference in New Issue
Block a user