MCPcopy Create free account
hub / github.com/defold/defold / DoLoad

Function DoLoad

engine/dlib/src/dlib/configfile.cpp:662–715  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

660 }
661
662 static Result DoLoad(const char* url, int argc, const char** argv, HConfig* config)
663 {
664 assert(url);
665 assert(config);
666
667 *config = 0;
668
669 dmURI::Parts uri_parts;
670 dmURI::Result r = dmURI::Parse(url, &uri_parts);
671 if (r == dmURI::RESULT_OK)
672 {
673 if (strcmp(uri_parts.m_Scheme, "http") == 0 || strcmp(uri_parts.m_Scheme, "https") == 0)
674 {
675 return LoadFromHttpInternal(url, uri_parts, argc, argv, config, LoadFromBufferInternal);
676 }
677 else if (strcmp(uri_parts.m_Scheme, "file") == 0)
678 {
679 return LoadFromFileInternal(uri_parts.m_Path, argc, argv, config);
680 }
681 else if (strcmp(uri_parts.m_Scheme, "data") == 0 || strcmp(uri_parts.m_Scheme, "host") == 0)
682 {
683 return LoadFromFileInternal(url, argc, argv, config);
684 }
685 else
686 {
687#if defined(_WIN32)
688 // any drive letter is ok
689 if (strlen(uri_parts.m_Scheme) == 1)
690 {
691 if (dmSys::Exists(url))
692 {
693 // In order to support windows paths with drive letter we
694 // first test if the url is a valid file
695 return LoadFromFileInternal(url, argc, argv, config);
696 }
697 else
698 {
699 return RESULT_FILE_NOT_FOUND;
700 }
701 }
702#endif
703 return RESULT_INVALID_URI;
704 }
705 }
706
707 if (dmSys::Exists(url))
708 {
709 // In order to support windows paths with drive letter we
710 // first test if the url is a valid file
711 return LoadFromFileInternal(url, argc, argv, config);
712 }
713
714 return RESULT_INVALID_URI;
715 }
716
717 Result Load(const char* url, int argc, const char** argv, HConfig* config)
718 {

Callers 1

LoadFunction · 0.70

Calls 5

LoadFromFileInternalFunction · 0.85
ParseFunction · 0.70
LoadFromHttpInternalFunction · 0.70
ExistsFunction · 0.70
assertFunction · 0.50

Tested by

no test coverage detected