* Get lua file full path from relative path */
| 47 | * Get lua file full path from relative path |
| 48 | */ |
| 49 | FString GetFullPathFromRelativePath(const FString& RelativePath) |
| 50 | { |
| 51 | FString FullFilePath = GLuaSrcFullPath + RelativePath; |
| 52 | FString ProjectDir = FPaths::ConvertRelativePathToFull(FPaths::ProjectDir()); |
| 53 | FString ProjectPersistentDownloadDir = FPaths::ConvertRelativePathToFull(FPaths::ProjectPersistentDownloadDir()); |
| 54 | if (!ProjectPersistentDownloadDir.EndsWith("/")) |
| 55 | { |
| 56 | ProjectPersistentDownloadDir.Append("/"); |
| 57 | } |
| 58 | |
| 59 | FString RealFullFilePath = FullFilePath.Replace(*ProjectDir, *ProjectPersistentDownloadDir); // try to load the file from 'ProjectPersistentDownloadDir' first |
| 60 | if (IFileManager::Get().FileExists(*RealFullFilePath)) |
| 61 | { |
| 62 | FullFilePath = RealFullFilePath; |
| 63 | } |
| 64 | else |
| 65 | { |
| 66 | if (!IFileManager::Get().FileExists(*FullFilePath)) |
| 67 | { |
| 68 | FullFilePath = ""; |
| 69 | } |
| 70 | } |
| 71 | return FullFilePath; |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Set the name for a Lua table which on the top of the stack |