The Function FPaths::CollapseRelativeDirectories assumes that any instance of the characters "/.." are a relative path to the parent directory, and removes them along with the preceding directory. However, it's valid in Windows to create a folder that beings with two periods, meaning the resulting path will be misinterpreted by our collapse function. This caused an issue with a licensee where a user had put two periods before their username, resulting in the user directory "C:/Users/..username/somefolder" resolving as "C:username/somefolder".
Solving this would likely require looking ahead at the next character following "/.." to see if it is a slash or if it's at the end of the path. Otherwise, it should be ignored.
Run the following code, and observe the output:
FString Path = "C:/My/./Path/..FolderName"; FPaths::CollapseRelativeDirectories(Path); UE_LOG(LogTemp, Warning, TEXT("Output: %s"),*Path);
Expected output: "C:/My/Path/..FolderName"
Actual output: "C:/My/.FolderName"
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-76854 in the post.
0 |
Component | UE - Foundation - Core |
---|---|
Affects Versions | 4.24 |
Target Fix | 4.25 |
Created | Jul 3, 2019 |
---|---|
Resolved | Nov 25, 2019 |
Updated | Mar 2, 2020 |