Add new API to convert absolute source paths to relative paths. (#930)
There are already APIs for getting a relative product path from an absolute source path, or getting a relative source path for an *existing* source file, but there were no APIs for getting a relative source path for a *new* source file. Prefabs will need this ability to be able to correctly generate a relative source path inside the prefab file before the file has been saved. The logic for relative source paths is a little bit tricky because the paths are relative to the watch folders, and the watch folders can be nested, with different priorities to explain which should take precedence. The input paths can also include specifiers like "." and "..", which need to be reconciled before creating the final correct relative path. The included unit tests test all of the tricky edge cases that I was able to identify.
This commit is contained in:
@@ -655,6 +655,80 @@ namespace AssetProcessor
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetCatalog::GenerateRelativeSourcePath(
|
||||
const AZStd::string& sourcePath, AZStd::string& relativePath, AZStd::string& rootFolder)
|
||||
{
|
||||
QString normalizedSourcePath = AssetUtilities::NormalizeFilePath(sourcePath.c_str());
|
||||
QDir inputPath(normalizedSourcePath);
|
||||
QString scanFolder;
|
||||
QString relativeName;
|
||||
|
||||
bool validResult = false;
|
||||
|
||||
AZ_TracePrintf(AssetProcessor::DebugChannel, "ProcessGenerateRelativeSourcePathRequest: %s...\n", sourcePath.c_str());
|
||||
|
||||
if (sourcePath.empty())
|
||||
{
|
||||
// For an empty input path, do nothing, we'll return an empty, invalid result.
|
||||
// (We check fullPath instead of inputPath, because an empty fullPath actually produces "." for inputPath)
|
||||
}
|
||||
else if (inputPath.isAbsolute())
|
||||
{
|
||||
// For an absolute path, try to convert it to a relative path, based on the existing scan folders.
|
||||
// To get the inputPath, we use absolutePath() instead of path() so that any . or .. entries get collapsed.
|
||||
validResult = m_platformConfig->ConvertToRelativePath(inputPath.absolutePath(), relativeName, scanFolder);
|
||||
}
|
||||
else if (inputPath.isRelative())
|
||||
{
|
||||
// For a relative path, concatenate it with each scan folder, and see if a valid relative path emerges.
|
||||
int scanFolders = m_platformConfig->GetScanFolderCount();
|
||||
for (int scanIdx = 0; scanIdx < scanFolders; scanIdx++)
|
||||
{
|
||||
auto& scanInfo = m_platformConfig->GetScanFolderAt(scanIdx);
|
||||
QDir possibleRoot(scanInfo.ScanPath());
|
||||
QDir possibleAbsolutePath = possibleRoot.filePath(normalizedSourcePath);
|
||||
// To get the inputPath, we use absolutePath() instead of path() so that any . or .. entries get collapsed.
|
||||
if (m_platformConfig->ConvertToRelativePath(possibleAbsolutePath.absolutePath(), relativeName, scanFolder))
|
||||
{
|
||||
validResult = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The input has produced a valid relative path. However, the path might match multiple nested scan folders,
|
||||
// so look to see if a higher-priority folder has a better match.
|
||||
if (validResult)
|
||||
{
|
||||
QString overridingFile = m_platformConfig->GetOverridingFile(relativeName, scanFolder);
|
||||
|
||||
if (!overridingFile.isEmpty())
|
||||
{
|
||||
overridingFile = AssetUtilities::NormalizeFilePath(overridingFile);
|
||||
validResult = m_platformConfig->ConvertToRelativePath(overridingFile, relativeName, scanFolder);
|
||||
}
|
||||
}
|
||||
|
||||
if (!validResult)
|
||||
{
|
||||
// if we are here it means we have failed to determine the relativePath, so we will send back the original path
|
||||
AZ_TracePrintf(AssetProcessor::DebugChannel,
|
||||
"GenerateRelativeSourcePath found no valid result, returning original path: %s...\n", sourcePath.c_str());
|
||||
|
||||
rootFolder.clear();
|
||||
relativePath.clear();
|
||||
relativePath = sourcePath;
|
||||
return false;
|
||||
}
|
||||
|
||||
relativePath = relativeName.toUtf8().data();
|
||||
rootFolder = scanFolder.toUtf8().data();
|
||||
|
||||
AZ_Assert(!relativePath.empty(), "ConvertToRelativePath returned true, but relativePath is empty");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetCatalog::GetFullSourcePathFromRelativeProductPath(const AZStd::string& relPath, AZStd::string& fullSourcePath)
|
||||
{
|
||||
ProcessGetFullSourcePathFromRelativeProductPathRequest(relPath, fullSourcePath);
|
||||
|
||||
@@ -95,6 +95,12 @@ namespace AssetProcessor
|
||||
const char* GetAbsoluteDevGameFolderPath() override;
|
||||
const char* GetAbsoluteDevRootFolderPath() override;
|
||||
bool GetRelativeProductPathFromFullSourceOrProductPath(const AZStd::string& fullPath, AZStd::string& relativeProductPath) override;
|
||||
|
||||
//! Given a partial or full source file path, respond with its relative path and the watch folder it is relative to.
|
||||
//! The input source path does not need to exist, so this can be used for new files that haven't been saved yet.
|
||||
bool GenerateRelativeSourcePath(
|
||||
const AZStd::string& sourcePath, AZStd::string& relativePath, AZStd::string& watchFolder) override;
|
||||
|
||||
bool GetFullSourcePathFromRelativeProductPath(const AZStd::string& relPath, AZStd::string& fullSourcePath) override;
|
||||
bool GetAssetInfoById(const AZ::Data::AssetId& assetId, const AZ::Data::AssetType& assetType, const AZStd::string& platformName, AZ::Data::AssetInfo& assetInfo, AZStd::string& rootFilePath) override;
|
||||
bool GetSourceInfoBySourcePath(const char* sourcePath, AZ::Data::AssetInfo& assetInfo, AZStd::string& watchFolder) override;
|
||||
|
||||
@@ -104,6 +104,27 @@ namespace
|
||||
return GetRelativeProductPathFromFullSourceOrProductPathResponse(relPathFound, relProductPath);
|
||||
}
|
||||
|
||||
GenerateRelativeSourcePathResponse HandleGenerateRelativeSourcePathRequest(
|
||||
MessageData<GenerateRelativeSourcePathRequest> messageData)
|
||||
{
|
||||
bool relPathFound = false;
|
||||
AZStd::string relPath;
|
||||
AZStd::string watchFolder;
|
||||
|
||||
AzToolsFramework::AssetSystemRequestBus::BroadcastResult(
|
||||
relPathFound, &AzToolsFramework::AssetSystemRequestBus::Events::GenerateRelativeSourcePath,
|
||||
messageData.m_message->m_sourcePath, relPath, watchFolder);
|
||||
|
||||
if (!relPathFound)
|
||||
{
|
||||
AZ_TracePrintf(
|
||||
AssetProcessor::ConsoleChannel, "Could not find relative source path for the source file (%s).",
|
||||
messageData.m_message->m_sourcePath.c_str());
|
||||
}
|
||||
|
||||
return GenerateRelativeSourcePathResponse(relPathFound, relPath, watchFolder);
|
||||
}
|
||||
|
||||
SourceAssetInfoResponse HandleSourceAssetInfoRequest(MessageData<SourceAssetInfoRequest> messageData)
|
||||
{
|
||||
SourceAssetInfoResponse response;
|
||||
@@ -407,6 +428,7 @@ AssetRequestHandler::AssetRequestHandler()
|
||||
|
||||
m_requestRouter.RegisterMessageHandler(&HandleGetFullSourcePathFromRelativeProductPathRequest);
|
||||
m_requestRouter.RegisterMessageHandler(&HandleGetRelativeProductPathFromFullSourceOrProductPathRequest);
|
||||
m_requestRouter.RegisterMessageHandler(&HandleGenerateRelativeSourcePathRequest);
|
||||
m_requestRouter.RegisterMessageHandler(&HandleSourceAssetInfoRequest);
|
||||
m_requestRouter.RegisterMessageHandler(&HandleSourceAssetProductsInfoRequest);
|
||||
m_requestRouter.RegisterMessageHandler(&HandleGetScanFoldersRequest);
|
||||
|
||||
@@ -57,6 +57,9 @@ namespace AzFramework
|
||||
class GetRelativeProductPathFromFullSourceOrProductPathRequest;
|
||||
class GetRelativeProductPathFromFullSourceOrProductPathResponse;
|
||||
|
||||
class GenerateRelativeSourcePathRequest;
|
||||
class GenerateRelativeSourcePathResponse;
|
||||
|
||||
class GetFullSourcePathFromRelativeProductPathRequest;
|
||||
class GetFullSourcePathFromRelativeProductPathResponse;
|
||||
class AssetNotificationMessage;
|
||||
@@ -104,6 +107,8 @@ namespace AssetProcessor
|
||||
using GetAbsoluteAssetDatabaseLocationResponse = AzToolsFramework::AssetSystem::GetAbsoluteAssetDatabaseLocationResponse;
|
||||
using GetRelativeProductPathFromFullSourceOrProductPathRequest = AzFramework::AssetSystem::GetRelativeProductPathFromFullSourceOrProductPathRequest;
|
||||
using GetRelativeProductPathFromFullSourceOrProductPathResponse = AzFramework::AssetSystem::GetRelativeProductPathFromFullSourceOrProductPathResponse;
|
||||
using GenerateRelativeSourcePathRequest = AzFramework::AssetSystem::GenerateRelativeSourcePathRequest;
|
||||
using GenerateRelativeSourcePathResponse = AzFramework::AssetSystem::GenerateRelativeSourcePathResponse;
|
||||
using GetFullSourcePathFromRelativeProductPathRequest = AzFramework::AssetSystem::GetFullSourcePathFromRelativeProductPathRequest;
|
||||
using GetFullSourcePathFromRelativeProductPathResponse = AzFramework::AssetSystem::GetFullSourcePathFromRelativeProductPathResponse;
|
||||
|
||||
|
||||
@@ -224,6 +224,18 @@ namespace AssetProcessor
|
||||
dbConn->SetScanFolder(newScanFolder);
|
||||
}
|
||||
|
||||
virtual void AddScanFolders(
|
||||
const QDir& tempPath, AssetDatabaseConnection* dbConn, PlatformConfiguration& config,
|
||||
const AZStd::vector<AssetBuilderSDK::PlatformInfo>& platforms)
|
||||
{
|
||||
// PATH DisplayName PortKey root recurse platforms order
|
||||
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "subfolder4", "subfolder4", false, false, platforms, -6), config, dbConn); // subfolder 4 overrides subfolder3
|
||||
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "subfolder3", "subfolder3", false, false, platforms, -5), config, dbConn); // subfolder 3 overrides subfolder2
|
||||
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "subfolder2", "subfolder2", false, true, platforms, -2), config, dbConn); // subfolder 2 overrides subfolder1
|
||||
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", false, true, platforms, -1), config, dbConn); // subfolder1 overrides root
|
||||
AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "tempfolder", true, false, platforms, 0), config, dbConn); // add the root
|
||||
}
|
||||
|
||||
// build some default configs.
|
||||
void BuildConfig(const QDir& tempPath, AssetDatabaseConnection* dbConn, PlatformConfiguration& config)
|
||||
{
|
||||
@@ -232,12 +244,8 @@ namespace AssetProcessor
|
||||
config.EnablePlatform({ "fandango" ,{ "console", "renderer" } }, false);
|
||||
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
|
||||
config.PopulatePlatformsForScanFolder(platforms);
|
||||
// PATH DisplayName PortKey root recurse platforms order
|
||||
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "subfolder4", "subfolder4", false, false, platforms, -6), config, dbConn); // subfolder 4 overrides subfolder3
|
||||
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "subfolder3", "subfolder3", false, false, platforms, -5), config, dbConn); // subfolder 3 overrides subfolder2
|
||||
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "subfolder2", "subfolder2", false, true, platforms, -2), config, dbConn); // subfolder 2 overrides subfolder1
|
||||
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", false, true, platforms, -1), config, dbConn); // subfolder1 overrides root
|
||||
AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "tempfolder", true, false, platforms, 0), config, dbConn); // add the root
|
||||
|
||||
AddScanFolders(tempPath, dbConn, config, platforms);
|
||||
|
||||
config.AddMetaDataType("exportsettings", QString());
|
||||
|
||||
@@ -359,7 +367,8 @@ namespace AssetProcessor
|
||||
return false;
|
||||
}
|
||||
|
||||
// Calls the GetFullSourcePathFromRelativeProductPath function and checks the return results, returning true if it matches both of the expected results
|
||||
// Calls the GetFullSourcePathFromRelativeProductPath function and checks the return results, returning true if it matches both of
|
||||
// the expected results
|
||||
bool TestGetFullSourcePath(const QString& fileToCheck, const QDir& tempPath, bool expectToFind, const char* expectedPath)
|
||||
{
|
||||
bool fullPathfound = false;
|
||||
@@ -531,6 +540,177 @@ namespace AssetProcessor
|
||||
ASSERT_TRUE(TestGetRelativeProductPath(fileToCheck, true, { "aaa/basefile.txt" }));
|
||||
}
|
||||
|
||||
class AssetCatalogTestRelativeSourcePath : public AssetCatalogTest
|
||||
{
|
||||
public:
|
||||
QDir GetRoot()
|
||||
{
|
||||
// Return an OS-friendly absolute root directory for our tests ("C:/sourceRoot" or "/sourceRoot"). It doesn't
|
||||
// need to exist, it just needs to be an absolute path.
|
||||
return QDir::root().filePath("sourceRoot");
|
||||
}
|
||||
|
||||
// Set up custom scan folders for the "relative source path" tests, so that we can try out specific combinations of watch folders
|
||||
void AddScanFolders(
|
||||
[[maybe_unused]] const QDir& tempPath, AssetDatabaseConnection* dbConn, PlatformConfiguration& config,
|
||||
const AZStd::vector<AssetBuilderSDK::PlatformInfo>& platforms) override
|
||||
{
|
||||
QDir root = GetRoot();
|
||||
|
||||
// This will set up the following watch folders, in highest to lowest priority:
|
||||
|
||||
// /sourceRoot/recurseNested/nested (recurse)
|
||||
// /sourceRoot/noRecurse (no recurse)
|
||||
// /sourceRoot/recurseNotNested (recurse)
|
||||
// /sourceRoot/recurseNested (recurse)
|
||||
|
||||
AddScanFolder(
|
||||
ScanFolderInfo(root.filePath("recurseNested/nested"), "nested", "nested", false, true, platforms, -4), config, dbConn);
|
||||
AddScanFolder(
|
||||
ScanFolderInfo(root.filePath("noRecurse"), "noRecurse", "noRecurse", false, false, platforms, -3), config, dbConn);
|
||||
AddScanFolder(
|
||||
ScanFolderInfo(root.filePath("recurseNotNested"), "recurseNotNested", "recurseNotNested", false, true, platforms, -2),
|
||||
config, dbConn);
|
||||
AddScanFolder(
|
||||
ScanFolderInfo(root.filePath("recurseNested"), "recurseNested", "recurseNested", false, true, platforms, -1),
|
||||
config, dbConn);
|
||||
}
|
||||
|
||||
// Calls the GenerateRelativeSourcePath function and validates that the results match the expected inputs.
|
||||
void TestGetRelativeSourcePath(
|
||||
const AZStd::string& sourcePath, bool expectedToFind, const AZStd::string& expectedPath, const AZStd::string& expectedRoot)
|
||||
{
|
||||
bool relPathFound = false;
|
||||
AZStd::string relPath;
|
||||
AZStd::string rootFolder;
|
||||
|
||||
AzToolsFramework::AssetSystemRequestBus::BroadcastResult(
|
||||
relPathFound, &AzToolsFramework::AssetSystem::AssetSystemRequest::GenerateRelativeSourcePath, sourcePath,
|
||||
relPath, rootFolder);
|
||||
|
||||
EXPECT_EQ(relPathFound, expectedToFind);
|
||||
EXPECT_EQ(relPath, expectedPath);
|
||||
EXPECT_EQ(rootFolder, expectedRoot);
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(AssetCatalogTestRelativeSourcePath, GenerateRelativeSourcePath_EmptySourcePath_ReturnsNoMatch)
|
||||
{
|
||||
// Test passes in an empty source path, which shouldn't produce a valid result.
|
||||
// Input: empty source path
|
||||
// Output: empty, not found result
|
||||
TestGetRelativeSourcePath("", false, "", "");
|
||||
}
|
||||
|
||||
TEST_F(AssetCatalogTestRelativeSourcePath, GenerateRelativeSourcePath_AbsolutePathOutsideWatchFolders_ReturnsNoMatch)
|
||||
{
|
||||
// Test passes in an invalid absolute source path, which shouldn't produce a valid result.
|
||||
// Input: "/sourceRoot/noWatchFolder/test.txt"
|
||||
// Output: not found result, which also returns the input as the relative file name
|
||||
QDir watchFolder = GetRoot().filePath("noWatchFolder/");
|
||||
QString fileToCheck = watchFolder.filePath("test.txt");
|
||||
|
||||
TestGetRelativeSourcePath(fileToCheck.toUtf8().constData(), false, fileToCheck.toUtf8().constData(), "");
|
||||
}
|
||||
|
||||
TEST_F(AssetCatalogTestRelativeSourcePath, GenerateRelativeSourcePath_AbsolutePathUnderWatchFolder_ReturnsRelativePath)
|
||||
{
|
||||
// Test passes in a valid absolute source path, which should produce a valid relative path
|
||||
// Input: "/sourceRoot/noRecurse/test.txt"
|
||||
// Output: "test.txt" in folder "/sourceRoot/noRecurse/"
|
||||
QDir watchFolder = GetRoot().filePath("noRecurse/");
|
||||
QString fileToCheck = watchFolder.filePath("test.txt");
|
||||
|
||||
TestGetRelativeSourcePath(fileToCheck.toUtf8().constData(), true, "test.txt", watchFolder.path().toUtf8().constData());
|
||||
}
|
||||
|
||||
TEST_F(AssetCatalogTestRelativeSourcePath, GenerateRelativeSourcePath_AbsolutePathUnderNestedWatchFolders_ReturnsRelativePath)
|
||||
{
|
||||
// Test passes in a valid absolute source path that matches a watch folder and a nested watch folder.
|
||||
// The output relative path should match the nested folder, because the nested folder has a higher priority registered with the AP.
|
||||
// Input: "/sourceRoot/recurseNested/nested/test.txt"
|
||||
// Output: "test.txt" in folder "/sourceRoot/recurseNested/nested/"
|
||||
QDir watchFolder = GetRoot().filePath("recurseNested/nested/");
|
||||
QString fileToCheck = watchFolder.filePath("test.txt");
|
||||
|
||||
TestGetRelativeSourcePath(fileToCheck.toUtf8().constData(), true, "test.txt", watchFolder.path().toUtf8().constData());
|
||||
}
|
||||
|
||||
TEST_F(AssetCatalogTestRelativeSourcePath, GenerateRelativeSourcePath_BareFileNameValidInWatchFolder_ReturnsHighestPriorityWatchFolder)
|
||||
{
|
||||
// Test passes in a simple file name. The output should be relative to the highest-priority watch folder.
|
||||
// Input: "test.txt"
|
||||
// Output: "test.txt" in folder "/sourceRoot/recurseNested/nested/"
|
||||
QDir watchFolder = GetRoot().filePath("recurseNested/nested/");
|
||||
|
||||
TestGetRelativeSourcePath("test.txt", true, "test.txt", watchFolder.path().toUtf8().constData());
|
||||
}
|
||||
|
||||
TEST_F(AssetCatalogTestRelativeSourcePath, GenerateRelativeSourcePath_RelativePathValidInWatchFolder_ReturnsHighestPriorityWatchFolder)
|
||||
{
|
||||
// Test passes in a relative path. The output should preserve the relative path, but list it as relative to the highest-priority
|
||||
// watch folder.
|
||||
// Input: "a/b/c/test.txt"
|
||||
// Output: "a/b/c/test.txt" in folder "/sourceRoot/recurseNested/nested/"
|
||||
QDir watchFolder = GetRoot().filePath("recurseNested/nested/");
|
||||
|
||||
TestGetRelativeSourcePath("a/b/c/test.txt", true, "a/b/c/test.txt", watchFolder.path().toUtf8().constData());
|
||||
}
|
||||
|
||||
TEST_F(AssetCatalogTestRelativeSourcePath, GenerateRelativeSourcePath_RelativePathNotInWatchFolder_ReturnsNoMatch)
|
||||
{
|
||||
// Test passes in a relative path that "backs up" two directories. This will be invalid, because no matter which watch directory
|
||||
// we start at, the result will be outside of any watch directory.
|
||||
// Input: "../../test.txt"
|
||||
// Output: not found result, which also returns the input as the relative file name
|
||||
TestGetRelativeSourcePath("../../test.txt", false, "../../test.txt", "");
|
||||
}
|
||||
|
||||
TEST_F(AssetCatalogTestRelativeSourcePath, GenerateRelativeSourcePath_RelativePathValidFromNestedWatchFolder_ReturnsOuterFolder)
|
||||
{
|
||||
// Test passes in a relative path that "backs up" one directory. This will produce a valid result, because we can back up from
|
||||
// the "recurseNested/nested/" watch folder to "recurseNested", which is also a valid watch folder.
|
||||
// Input: "../test.txt"
|
||||
// Output: "test.txt" in folder "/sourceRoot/recurseNested"
|
||||
QDir watchFolder = GetRoot().filePath("recurseNested/");
|
||||
TestGetRelativeSourcePath("../test.txt", true, "test.txt", watchFolder.path().toUtf8().constData());
|
||||
}
|
||||
|
||||
TEST_F(AssetCatalogTestRelativeSourcePath, GenerateRelativeSourcePath_RelativePathMovesToParentWatchFolder_ReturnsOuterFolder)
|
||||
{
|
||||
// Test passes in a relative path that backs up one directory and then forward into a directory. This will produce a valid
|
||||
// result, because it can validly start in the highest-priority watch folder (recurseNested/nested), move back one into the
|
||||
// outer watch folder (recurseNested), and then have a subdirectory within it.
|
||||
// Note that it would also be valid to move from recurseNested to recurseNotNested, but that won't be the result of this test
|
||||
// because that's a lower-priority match.
|
||||
// Input: "../recurseNotNested/test.txt"
|
||||
// Output: "recurseNotNested/test.txt" in folder "/sourceRoot/recurseNested/"
|
||||
QDir watchFolder = GetRoot().filePath("recurseNested/");
|
||||
|
||||
TestGetRelativeSourcePath("../recurseNotNested/test.txt", true, "recurseNotNested/test.txt", watchFolder.path().toUtf8().constData());
|
||||
}
|
||||
|
||||
TEST_F(AssetCatalogTestRelativeSourcePath, GenerateRelativeSourcePath_RelativePathMovesToSiblingWatchFolder_ReturnsSiblingFolder)
|
||||
{
|
||||
// Test passes in a relative path that backs up two directories and then forward into a directory. This will produce a valid
|
||||
// result, because it can validly start in the recurseNested/nested folder, move back two folders, then forward into the sibling
|
||||
// recurseNotNested folder. The result will be a relative path to the sibling folder.
|
||||
// Input: "../../recurseNotNested/test.txt"
|
||||
// Output: "test.txt" in folder "/sourceRoot/recurseNotNested/"
|
||||
QDir watchFolder = GetRoot().filePath("recurseNotNested/");
|
||||
|
||||
TestGetRelativeSourcePath("../../recurseNotNested/test.txt", true, "test.txt", watchFolder.path().toUtf8().constData());
|
||||
}
|
||||
|
||||
TEST_F(AssetCatalogTestRelativeSourcePath, GenerateRelativeSourcePath_RelativePathBacksOutOfWatchFolder_ReturnsNoMatch)
|
||||
{
|
||||
// Test passes in a relative path that adds a directory, then "backs up" three directories. This will be invalid, because no
|
||||
// matter which watch directory we start at, the result will be outside of any watch directory.
|
||||
// Input: "../test.txt"
|
||||
// Output: "test.txt" in folder "/sourceRoot/recurseNested"
|
||||
TestGetRelativeSourcePath("a/../../../test.txt", false, "a/../../../test.txt", "");
|
||||
}
|
||||
|
||||
class AssetCatalogTest_GetFullSourcePath
|
||||
: public AssetCatalogTest
|
||||
{
|
||||
|
||||
@@ -265,6 +265,9 @@ namespace AssetProcessorMessagesTests
|
||||
|
||||
addPairFunc(new GetFullSourcePathFromRelativeProductPathRequest(), new GetFullSourcePathFromRelativeProductPathResponse());
|
||||
addPairFunc(new GetRelativeProductPathFromFullSourceOrProductPathRequest(), new GetRelativeProductPathFromFullSourceOrProductPathResponse());
|
||||
addPairFunc(
|
||||
new GenerateRelativeSourcePathRequest(),
|
||||
new GenerateRelativeSourcePathResponse());
|
||||
addPairFunc(new SourceAssetInfoRequest(), new SourceAssetInfoResponse());
|
||||
addPairFunc(new SourceAssetProductsInfoRequest(), new SourceAssetProductsInfoResponse());
|
||||
addPairFunc(new GetScanFoldersRequest(), new GetScanFoldersResponse());
|
||||
|
||||
@@ -51,6 +51,8 @@ namespace AssetProcessor
|
||||
public:
|
||||
using GetRelativeProductPathFromFullSourceOrProductPathRequest = AzFramework::AssetSystem::GetRelativeProductPathFromFullSourceOrProductPathRequest;
|
||||
using GetRelativeProductPathFromFullSourceOrProductPathResponse = AzFramework::AssetSystem::GetRelativeProductPathFromFullSourceOrProductPathResponse;
|
||||
using GenerateRelativeSourcePathRequest = AzFramework::AssetSystem::GenerateRelativeSourcePathRequest;
|
||||
using GenerateRelativeSourcePathResponse = AzFramework::AssetSystem::GenerateRelativeSourcePathResponse;
|
||||
using GetFullSourcePathFromRelativeProductPathRequest = AzFramework::AssetSystem::GetFullSourcePathFromRelativeProductPathRequest;
|
||||
using GetFullSourcePathFromRelativeProductPathResponse = AzFramework::AssetSystem::GetFullSourcePathFromRelativeProductPathResponse;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user