Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "FileOpsBPLibrary.h"
- #include <algorithm>
- #include <string>
- #include "FileOps.h"
- #include "FileDialog.h"
- bool UFileOpsBPLibrary::ShowOpenFileDialog(FString InitialDir, FString Title, bool UseFilter, FString& Filepath) {
- FileDialog* dialog = new FileDialog();
- dialog->FilterIndex = 1;
- InitialDir = InitialDir.Replace(TEXT("/"), TEXT("\\"));
- dialog->InitialDir = InitialDir.GetCharArray().GetData(); //cast FString to *TCHAR (not const *TCHAR)
- dialog->Title = Title.GetCharArray().GetData();
- if (UseFilter) {
- dialog->Filter = TEXT("Samurai Files (*.sam)\0*.sam\0All Files\0*.*\0\0");
- }
- if (dialog->ShowOpenFileDialog()) {
- Filepath = dialog->FileName;
- Filepath = Filepath.Replace(_T("\\"), _T("/"));
- return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement