Browse Source

Fix writing json as UTF16. Add new environments to dropdown

master 4.8.2
Thomas Cheyney 3 years ago
parent
commit
5e953465f3
6 changed files with 39 additions and 2 deletions
  1. +1
    -1
      Config/DefaultGame.ini
  2. BIN
      Content/Blueprints/BP_controller.uasset
  3. BIN
      Content/Blueprints/WidgetSongInfos.uasset
  4. BIN
      Content/Levels/Level_Startup.umap
  5. +31
    -0
      Source/MediocreMapAssistant2/BPFileIO.cpp
  6. +7
    -1
      Source/MediocreMapAssistant2/BPFileIO.h

+ 1
- 1
Config/DefaultGame.ini View File

@ -3,7 +3,7 @@ ProjectID=F5529D354BF9DDA5B4BC06BB62D10933
bShouldWindowPreserveAspectRatio=False
ProjectName=MediocreMapAssistant2
ProjectDisplayedTitle=NSLOCTEXT("[/Script/EngineSettings]", "A4F171D24A09E6B0C435A39031D526F5", "Mediocre Map Assistant 2")
ProjectVersion=4.8.0
ProjectVersion=4.8.2
[/Script/UnrealEd.ProjectPackagingSettings]
Build=IfProjectHasCode


BIN
Content/Blueprints/BP_controller.uasset View File


BIN
Content/Blueprints/WidgetSongInfos.uasset View File


BIN
Content/Levels/Level_Startup.umap View File


+ 31
- 0
Source/MediocreMapAssistant2/BPFileIO.cpp View File

@ -336,4 +336,35 @@ int UBPFileIO::getFileSize(const FString & File)
int UBPFileIO::getTimestamp(const FString & File)
{
return FPlatformFileManager::Get().GetPlatformFile().GetTimeStamp(*File).ToUnixTimestamp();
}
bool UBPFileIO::SaveStringTextToFile(
FString SaveDirectory,
FString JoyfulFileName,
FString SaveText,
bool AllowOverWriting
) {
if (!FPlatformFileManager::Get().GetPlatformFile().CreateDirectoryTree(*SaveDirectory))
{
//Could not make the specified directory
return false;
//~~~~~~~~~~~~~~~~~~~~~~
}
//get complete file path
SaveDirectory += "\\";
SaveDirectory += JoyfulFileName;
//No over-writing?
if (!AllowOverWriting)
{
//Check if file exists already
if (FPlatformFileManager::Get().GetPlatformFile().FileExists(*SaveDirectory))
{
//no overwriting
return false;
}
}
return FFileHelper::SaveStringToFile(SaveText, *SaveDirectory, FFileHelper::EEncodingOptions::ForceUTF8WithoutBOM);
}

+ 7
- 1
Source/MediocreMapAssistant2/BPFileIO.h View File

@ -55,5 +55,11 @@ class MEDIOCREMAPASSISTANT2_API UBPFileIO : public UBlueprintFunctionLibrary
UFUNCTION(BlueprintCallable, Category = "File IO")
static int getTimestamp(const FString& File);
UFUNCTION(BlueprintCallable, Category = "File IO")
static bool SaveStringTextToFile(
FString SaveDirectory,
FString JoyfulFileName,
FString SaveText,
bool AllowOverWriting);
};

Loading…
Cancel
Save