MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / GetFiles

Method GetFiles

Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp:1402–1432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1400}
1401
1402Array<String> SDLClipboard::GetFiles()
1403{
1404 auto mainWindow = Engine::MainWindow;
1405 if (!mainWindow)
1406 return Array<String>();
1407
1408 if (X11Impl::xDisplay)
1409 {
1410 X11::Window window = reinterpret_cast<X11::Window>(mainWindow->GetNativePtr());
1411 Array<String> array;
1412 X11Impl::ClipboardGetFiles(array, X11Impl::xAtomClipboard, X11Impl::xAtomUriList, window);
1413 if (array.Count() > 0)
1414 return array;
1415 return Array<String>();
1416 }
1417 else
1418 {
1419 size_t length = 0;
1420 const char* data = static_cast<const char*>(SDL_GetClipboardData("text/uri-list", &length));
1421 String stringBuffer = String(StringAnsi(data, length));
1422 Array<String> files;
1423 stringBuffer.Split('\n', files);
1424 for (auto& file : files)
1425 {
1426 if (file.StartsWith(TEXT("file://")))
1427 file = file.Substring(7);
1428 file = file.TrimTrailing(); // Trim '\r'
1429 }
1430 return files;
1431 }
1432}
1433
1434bool SDLCALL SDLPlatform::X11EventHook(void* userdata, _XEvent* xevent)
1435{

Callers

nothing calls this directly

Calls 9

ClipboardGetFilesFunction · 0.85
SubstringMethod · 0.80
TrimTrailingMethod · 0.80
StringClass · 0.50
StringAnsiFunction · 0.50
GetNativePtrMethod · 0.45
CountMethod · 0.45
SplitMethod · 0.45
StartsWithMethod · 0.45

Tested by

no test coverage detected